Call and hangup using Asterisk as a SIP client

user1204111 picture user1204111 · Jun 14, 2013 · Viewed 12.1k times · Source

I'm a newbie in Asterisk, so I'm gonna start with something simple.

I read some documentation and I've managed to do some basic config.

My Asterisk version is 1.6.2.9-2+squeeze10 (installed on Debian using apt-get) and changed ONLY sip.conf and extensions.conf.

My idea is to use it as a SIP client, connected to the Flowroute SIP server - but please see what's happening when I use console dial EXTEN...

sip.conf

[general]
register => 74770000:[email protected]/s
registertimeout=20
context=default
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
subscribecontext=from-sip

[flowroute]
canreinvite=no
username=74770000
fromuser=74770000
secret=HIDDEN
context=default
type=friend
fromdomain=sip.flowroute.com
host=85.17.214.222
dtmfmode=rfc2833
disallow=all
allow=alaw
allow=ulaw
nat=yes
insecure=very

extensions.conf

[default]
exten => _XXXXXXXXXXXXXX,1,Dial(SIP/flowroute/${EXTEN})
;exten => _XXXXXXXXXXXXXX,2,Hangup

sip show users

loreen*CLI> sip show users
Username                   Secret           Accountcode      Def.Context      ACL  NAT
flowroute                  HIDDEN                      default          No   Always

sip show peers

loreen*CLI> sip show peers
Name/username              Host            Dyn Nat ACL Port     Status
flowroute/74771200         85.17.214.227        N      5060     Unmonitored
1 sip peers [Monitored: 1 online, 0 offline Unmonitored: 0 online, 0 offline]

console dial EXTEN

loreen*CLI> console dial 00359891505054
[Jun 14 16:44:27] WARNING[14031]: chan_oss.c:486 setformat: Unable to re-open DSP device /dev/dsp: No such file or directory
[Jun 14 16:44:28] NOTICE[14031]: console_video.c:133 console_video_start: voice only, console video support not present
[Jun 14 16:44:28] WARNING[14033]: app_dial.c:1714 dial_exec_full: Skipping dialing interface 'SIP/flowroute/00359891505054' again since it has already been dialed

Answer

dougBTV picture dougBTV · Jun 14, 2013

Unfortunately, Asterisk 1.6.2 was made end-of-life in april 2012, and it doesn't seem this feature is still supported, and using a sound card with Asterisk isn't the most common use-case.

Installing Asterisk from source is rather easy, and also rather clean (make uninstall will sufficiently clean it out). I highly recommend it, as it allows you to stay ahead of the game (with security and feature releases). Try it with ./configure and then make menuselect (you'll need ncurses libraries) for a really nice build interface.

While trying to test dial outbound calls on your SIP trunk (to test it's connectivity), I would recommend using the channel originate function at the CLI.

For help:

asterisk*CLI> core show help channel originate

A specific device and parameter string using your setup:

asterisk*CLI> channel originate SIP/flowroute/00359891505054 application Playback tt-monkeys

Note: This will play the sound of screaming monkeys to the called party!

Also -- if you're a smart phone user, it's rather convenient to have a softphone hooked up as an extension to test your trunks, new dialplans, etc. (Although I'll always do my initial tests with channel originate)

Lastly -- but equally importantly... I realize this is a test scenario, but... As you bring this forward; I'd avoid directly dialing your ITSP with the dialed extension from the [default] context. This could, if not otherwise configured properly, leave you open to toll-fraud via the fact that asterisk defaults call attempts to this context if the context is otherwise unknown.