Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

One of the issues I'm having now is that if I call in consecutive times to the asterisk server from the same phone, it may disconnect. Asterisk logs the following message:

[Aug 14 10:24:56] NOTICE[20537]: chan_sip.c:19477 handle_request_invite: Failed to authenticate device <sip:4165559999@222.222.222.222:5070>;tag=781ab8fb-co19342-INS016

It's like any phone in the world can only call in once to the asterisk server. Then I need to do a

> sip reload

from the Asterisk terminal to let them call in again.

I can also do a shell command like so to reload the sip

asterisk -rx 'sip reload'

But when I add this command to the crontab to be run every minute, it doesn't work. The shell command only works if I run it manually.

Can anyone tell me how I can enable callers to call my asterisk server more than once? Here are my sip.conf and extensions.conf (all other files untouched).

sip.conf

[general]
register => mysipuser:mysippass@localhost:5071
context=default

[mysipuser]
type=friend
secret=mysippass
username=mysipuser
host=111.111.111.111
port=5071
fromuser=mysipuser
canreinvite=no
insecure=very
qualify=2000
dtmfmode=inband
nat=no
context=default

extensions.conf

[default]
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(vm-extension)
exten => s,n,WaitExten()

exten => 0011,1,Goto(outbound,s,1)

exten => 11,1,Dial(SIP/mysipuser/5555555555) ;calls 555-555-5555
exten => 11,n,Hangup ; this line never gets executed

exten => 77,1,Dial(SIP/mysipuser/1111111111) ;calls 111-111-1111
exten => 77,n,Hangup ; this line never gets executed


[outbound]
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(vm-extension)
exten => s,n,WaitExten()

exten => _NXXNXXNXXX,1,Dial(SIP/mysipuser/${EXTEN})
exten => _NXXNXXNXXX,n,Hangup

Additional Details I noticed that each time I execute the Dial() command in the extensions.conf, none of the lines after it gets fired, even if both parties hang up the phone. So for example:

exten => 11,1,Dial(SIP/mysipuser/5555555555)
exten => 11,n,System(echo 'hello world'>test.txt) ; this line and any line below do not fire
exten => 11,n,Hangup

The code stops executing after the Dial() command...that might explain why I can't call consecutive times..it's because the line is still active?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

This is my new extensions.conf which seems to have solved the problem

[default]
exten => s,1,System(asterisk -rx 'sip reload') ; hack to force sip reload
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(vm-extension)
exten => s,n,WaitExten()

exten => 0011,1,Goto(outbound,s,1)

exten => 11,1,Dial(SIP/mysipuser/5555555555,30,g) ;calls 555-555-5555
exten => 11,n,Goto(closechannel,s,1)

exten => 77,1,Dial(SIP/mysipuser/1111111111,30,g) ;calls 111-111-1111
exten => 77,n,Goto(closechannel,s,1)


[outbound]
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(vm-extension)
exten => s,n,WaitExten()

exten => _NXXNXXNXXX,1,Dial(SIP/mysipuser/${EXTEN})
exten => _NXXNXXNXXX,n,Hangup

[closechannel]
exten => s,1,System(asterisk -rx 'sip reload')
exten => s,n,Hangup()

So the three changes I made were the addition of the exten => s,1,System(asterisk -rx 'sip reload') statement, [closechannel] context, and the ,30,g to the Dial() command. The System command forces a sip reload every time someone tries to call in. The ,g flag tells asterisk to continue executing code after calling parties disconnect.

This seems to work "most" of the times.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.