Cannot originate call with Asterisk - asterisk

Hopefully someone can help me out, I've been breaking my head for a few days and have read a ton of threads on the internet to no avail.
My ultimate goal is to use the AMI to originate a call and pass it off to a script. Unfortunately I cannot get originate to work so I have simplified the flow to try and debug the issue. I am trying to just originate a call from the dialplan now and play a sound file. After a short time the call gets cancelled and the SIP client that originated the call gets a declined.
This same configuration works perfectly exactly as is using the Dial command instead of the Originate command.
Below I am including a SIP debug from the console of the originate and the relevant sip.conf bits. The sever is using Asterisk v1.8.32.3.
All IPs and phone numbers have been changed to protect the innocent.
111.111.111.111 (Asterisk Server IP)
222.222.222.222 (SIP Termination Provider)
333.333.333.333 (Originating SIP Client)
sip.conf
[vitel-outbound]
type=friend
dtmfmode=auto
host=222.222.222.222
allow=all
canreinvite=no
nat=yes
trustrpid=yes
sendrpid=yes
[front4]
type=friend
context=outgoing-calls
host=dynamic
defaultuser=front4
secret=password
nat=yes
qualify=yes
limitonpeers=yes
call-limit=10
port=5060
canreinvite=no
dtmfmode=rfc2833
disallow=all
allow=ulaw
SIP Debug

Looking at your trace, the Asterisk is cancelling the outbound call.
Without timestamps or more logging it's impossible to say why definitively. However, looking at the timestamps of the outbound INVITE and the OPTIONS from the originating client it would seem that the Originate() command is simply timing out. The Originate() command has a hard-coded 30-second timeout.
When the Originate() command terminates then the inbound call from the client hits the Hangup() step in the dialplan. This sends a 603 Declined response since the inbound call was never answered.

Related

How to route call from VoiceBlue Next device to Asterisk Server

I want to setup and IVR Menu i mean if a user calls to a particular GSM Number then the number should be redirected to Asterisk Server and the user needs to Get IVR Menu
I am using VoiceBlue Next firmware version 1.31.1.34.1 inserted working SIM Card
If i make a call to that particular number i am able to accept call,reject call and other options from VoiceBlueNext Web Interface.
I have made a SIP account in pjsip.conf file and created and extension as 100 in extensions.conf but unable to transfer the call to Asterisk Server
In asterisk server are there any other files to be changed or any settings in VoiceBlue Next
There are not many details to understand your scenario, I have not used VoiceBlue but on Asterisk if you want to receive calls, from your VoiceBlue or any other provider. You have to do two things, one you have to register this peer to allow receive calls, or you can also set allowguest=yes(but very dangerous anyone can send you calls) or add peers at end of pjsip.conf file as little secure way.
Next, you need to add dialplan, suppose if you get any number _X will be any number, now you can put Dial your extension to receive any number from the provider.
As for sip client to call out you have to register peer and both must be in the same context.
Sending outgoing calls, now if you call any number beginning 6 and 7 they will be forwarded to VoiceBlue
exten=>_6XXXXXXXX,1,Dial(SIP/${EXTEN:0}#10.0.0.20,,r)
exten=>_7XXXXXXXX,1,Dial(SIP/${EXTEN:0}#10.0.0.20,,r)
for incoming please add following in your pjsip.conf
[VoiceBlueNext]
type=peer
host=10.0.0.20
username=voiceblue
secret=password
fromdomain=10.0.0.20
and in same file on top put following general section
[general]
port = 5060
bindaddr = 0.0.0.0
allowgues=no
context = sip
disallow=all
allow=ulaw
Notice I allowguest = no , so you must provide peer VoiceBlue peer information to receive calls, but if you want to test, make it yes and you will get calls without any security.

No ring back tone on outbound calls. [FreePBX]

I have a FreePBX 13 server set up with a SIP Trunk connection, however for some reason we are not getting the ring back tone for calls going out of the trunk connection.
I was able to implement a work around for this by placing the "Tr" options under "Asterisk Trunk Dial Options" to force Asterisk to produce the ring back tone for outbound calls.
However this only works while manually dialing from a soft-phone / VoIP Phone, when I try to launch a call via the Asterisk AMI "Originate" command we are not getting the ring back tone, even when the "r" option is set on the trunk. This is how the command I'm sending looks:
Action: Originate,
Channel: SIP/{extension},
Context: from-internal,
Exten: {phoneNumber},
Priority: 1,
Callerid: {callerId},
Timeout: 30000,
Async: yes
Any idea about what can I do to force the ring back tone?
This could be due to inband progress.
Try to add the following to your sip.conf
under [general] section,
prematuremedia=no
progressinband=yes
if you are using freepbx, then navigate to your trunk settings in the user interface and add the above 2 configs under the peer settings.
restart asterisk and try after that.
Launch Originate via Local/ channel call, if still not work, launch via custom context which answer first.
This is not an uncommon problem. Your ITSP is being lazy and either not providing or not forwarding RFC-complaince SIP 180/183 responses.
My usual solution is to put the local caller into an MOH state where the MOH is a ring tone, and then when the other end picks up, bridge the two calls.
This is kind of jarring, however, if the remote end is busy or is congested, since you go from "fake ring" to "real error tone". The other option is to reverse your dialing process ... call the remote end and then hook the local end, so that the local end doesn't need to hear ringing.
Of course, you can also reach out to your ITSP and tell them you need them to be RFC SIP 180/183 complaint.

asterisk zoiper registration failed

I'm using Asterisk to register sip client but it shows me this message:
NOTICE[3212]: chan_sip.c:25797 handle_request_register: Registration from '' failed for '192.xx.xx.xx:5060' - Wrong password
that's what I configure in sip.conf:
[user1]
type=friend
host=dynamic
secret=root
context=users
nat=no
[user2]
type=friend
host=dynamic
secret=rootroot
context=users
nat=no
in extensions.conf:
[users]
exten=>6001,1,Dial(SIP/user1,20)
exten=>6002,1,Dial(SIP/user2,20)
when I use sip show users, I don't find any user.
u forgot to add
[user1]
...
defaultuser=user1
[user2]
...
defaultuser=user2
It looks like to be asked in Server Fault though.
Error says 'Wrong Password' though did you make sure its correct?
How did you set up Zoiper?
I recommend you set keepalive as well.
Otherwise zoiper will be unregistered from Asterisk.
And also make sure you set up zoiper to work background if you want to take call all the time.
You can turn on background functionality here.
Settings > Incoming Calls

Request timeouts due to register/unregister conflicts in asterisk

I have installed asterisk 11.5.1, and I have Bria on iPhone as the sip client. username/passwords are set in sip.conf, and the default dialplan (used by the clients) is
exten => _X.,1,Dial(SIP/${EXTEN},20)
exten => _X.,n,Hangup()
I have two iphones, say A and B, and I attached to the running asterisk with asterisk -rvvvv. When I hit 'Register' button from A, I see
Registered SIP 'A' at ww.xx.yy.zz:mmmm
message on the asterisk cli. When I hit 'Register' button from B, I see
Registered SIP 'B' at aa.bb.cc.dd:nnnn
Unregistered SIP 'B' <== HERE IS THE PROBLEM
although I do not hit Unregister from client B. Besides, B seems registered at the client. From now on, any call from B results in 'request timeout'. And if I call B from A, I see 'subscriber absent' message on the asterisk cli.
Why is asterisk unregistering client B? Any suggestion?
p.s.: I see the following error in asterisk cli:
chan_sip.c:3905 __sip_xmit: sip_xmit of 0x7f7df4027b00 (len 622) to aa.bb.cc.dd:nnnn returned -2: Interrupted system call
EDIT: My sip.conf file is as following
[myConf](!)
disallow=all
allow=g729
allow=gsm
allow=g723
allow=ulaw
allow=ilbc
directmedia=no
host=dynamic
dtmfmode=rfc2833
context=default
type=friend
transport=tls,tcp
qualify=4000
nat=force_rport,comedia
encryption=yes
[A](myConf)
secret=AAAA
[B](myConf)
secret=BBBB
I can't give you the exact solution but I can point to where it may can be the problem.
The documentated part of the code from where you hit the problem in chan_sip.c says
* \return length of transmitted message, XMIT_ERROR on know network failures -1 on other failures
In your case you fall on the other failures as Interrupted system call. That message led me to an open bug suspended due to lack of activity here. So my bid is that this error is more related to operating system than Asterisk itself.
My following question is, if you invert the order (first register B and then register A) is the last one who gets the error? If yes then you may start looking at the selinux or any other security tool that is killing the connection after is established. Otherwise you may need to update the bug and let the people from Asterisk fix the bug.
Let us know the result, is always nice to find posts with fixes :)
I think you need deal with NAT
http://www.voip-info.org/wiki/view/Asterisk+SIP+NAT+solutions
OR you have check that your B can got message from asterisk and answer it correctly. More info can be got using sip debug
asterisk -r
sip set debug on

Call and hangup using Asterisk as a SIP client

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:HIDDEN#sip.flowroute.com/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
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.

Resources