Skip to main content

Can't get inbound call to route to extension

Posted by studiox on Tue, 09/28/2010

Hi,

I just installed the ThirdLine Multi-Tentant version and have setup a test trunk to a provider as well as a extension.

So far everything works, my phone works, I have created outbound rules and they have been applied so outbound calls works without problems.

But I haven't been able to make inbound calls. When I follow the debug log I get the following:


2010-09-28 10:03:17] VERBOSE[13100] pbx.c: -- Executing [s@from-outside:2] Set("SIP/CellIP-00000000", "__INCOMINGCLI=0763411153") in new stack
[2010-09-28 10:03:17] VERBOSE[13100] pbx.c: -- Executing [s@from-outside:3] Goto("SIP/CellIP-00000000", "from-outside-redir,s,1") in new stack
[2010-09-28 10:03:17] VERBOSE[13100] pbx.c: -- Goto (from-outside-redir,s,1)
[2010-09-28 10:03:17] VERBOSE[13100] pbx.c: -- Sent into invalid extension 's' in context 'from-outside-redir' on SIP/CellIP-00000000
[2010-09-28 10:03:17] VERBOSE[13100] pbx.c: -- Executing [i@from-outside-redir:1] Progress("SIP/CellIP-00000000", "") in new stack
[2010-09-28 10:03:17] VERBOSE[13100] pbx.c: -- Executing [i@from-outside-redir:2] Wait("SIP/CellIP-00000000", ".5") in new stack
[2010-09-28 10:03:18] VERBOSE[13100] pbx.c: -- Executing [i@from-outside-redir:3] Zapateller("SIP/CellIP-00000000", "") in new stack
[2010-09-28 10:03:20] VERBOSE[13100] pbx.c: -- Executing [i@from-outside-redir:4] Playback("SIP/CellIP-00000000", "discon-or-out-of-service,noanswer") in new stack
[2010-09-28 10:03:20] WARNING[13100] file.c: File discon-or-out-of-service does not exist in any format
[2010-09-28 10:03:20] WARNING[13100] file.c: Unable to open discon-or-out-of-service (format 0x4 (ulaw)): No such file or directory
[2010-09-28 10:03:20] WARNING[13100] app_playback.c: ast_streamfile failed on SIP/CellIP-00000000 for discon-or-out-of-service,noanswer
[2010-09-28 10:03:20] VERBOSE[13100] pbx.c: -- Executing [i@from-outside-redir:5] Wait("SIP/CellIP-00000000", "1") in new stack
[2010-09-28 10:03:21] VERBOSE[13100] pbx.c: -- Executing [i@from-outside-redir:6] Hangup("SIP/CellIP-00000000", "1") in new stack
[2010-09-28 10:03:21] VERBOSE[13100] pbx.c: == Spawn extension (from-outside-redir, i, 6) exited non-zero on 'SIP/CellIP-00000000'

Obviously there is something wrong as asterisk does not find a way to route the call. If I try to look trough [from-outside-redir] I have the following:


[from-outside]
exten => _X.,1,Wait(1)
exten => _X.,n,Set(__INCOMINGCLI=${CALLERID(num)})
exten => _X.,n,Goto(from-outside-redir,${EXTEN},1)
exten => _+X.,1,Wait(1)
exten => _+X.,n,Set(__INCOMINGCLI=${CALLERID(num)})
exten => _+X.,n,Goto(from-outside-redir,${EXTEN},1)
exten => s,1,Wait(1)
exten => s,n,Set(__INCOMINGCLI=${CALLERID(num)})
exten => s,n,Goto(from-outside-redir,${EXTEN},1)

[from-outside-redir]

#include inbound.include
#include inbound_actions.include
....

The inbound* files as follows: (Number has been replaced with XXXXXXXX

Inbound.actions

[from-outside-468XXXXXXXX-any]
exten => 468XXXXXXXX,1,Set(__tenant=thirdlane)
exten => 468XXXXXXXX,2,Set(CDR(userfield)=thirdlane)
exten => 468XXXXXXXX,3,Set(MOH=${DB(TL/MOH/default${TL_DASH}${tenant})})
exten => 468XXXXXXXX,n,GotoIf($["${MOH}" = ""]?nomoh)
exten => 468XXXXXXXX,n,Set(CHANNEL(musicclass)=${MOH})
exten => 468XXXXXXXX,n(nomoh),Macro(tl-goto-userextension,100,Test)

Inbound.source

[468XXXXXXXX]
schedule_0=any
channels=
action_0=tl-goto-userextension
var_0=
description=Whatever
billable=no
tenant=thirdlane
args_0=100,Test
routetype=operator

Im not sure if asterisk does not detect the A-numner correct from my SIP trunk or if I have done something obvious wrong when creating the DDI or the inbound rule?


Submitted by studiox on Tue, 09/28/2010 Permalink

The last two source should of course be include inbound.include and include inbound_actions.include

Submitted by eeman on Tue, 09/28/2010 Permalink

problem seems pretty obvious to me...

[2010-09-28 10:03:17] VERBOSE[13100] pbx.c: -- Sent into invalid extension 's' in context 'from-outside-redir' on SIP/CellIP-00000000

you either are not getting a destination TN at all, or its being sent via equipment in a non-standard way. Some European clients have reported the latter and had to resulted to special programming to parse an innocuous header out of the SIP headers to delimit the destination TN (DID).

email off forum and I can explain further, perhaps help you write the script as well.

Submitted by hmelgers on Fri, 12/10/2010 Permalink

I've added this in user_extensions.include

[custom-get-did-from-sip]

exten => s,1,Noop(Fixing DID using information from SIP TO header)
exten => s,n,Set(pseudodid=${SIP_HEADER(To)})
exten => s,n,Set(pseudodid=${pseudoid:0:4}${pseudoid:5})
exten => s,n,Goto(from-outside-redir,${pseudoid},1)

but no change, what am i missing ?

Submitted by eeman on Fri, 12/10/2010 Permalink

change this line from:
exten => s,n,Goto(from-outside-redir,${pseudoid},1)

to:
exten => s,n,Goto(from-outside,${pseudoid},1)

and in sip.conf change the trunk's context= entry from from-outside to context=custom-get-did-from-sip

it should work as long as the 's' extension is good... watch the CLI... if it is trying to reach a specific extension instead of 's' you can do '_X.' instead of 's' in your dialplan.

Submitted by hmelgers on Fri, 12/10/2010 Permalink

Thanks Erik,

It still doesnt seem to pick up. Is this Set(pseudodid=${SIP_HEADER(To)}) correct ?

[2010-12-10 16:31:22] VERBOSE[25405] pbx.c: -- Executing [0356*0004@from-outside:1] Wait("SIP/31207163645-00000003", "1") in new stack
[2010-12-10 16:31:23] VERBOSE[25405] pbx.c: -- Executing [0356*0004@from-outside:2] Set("SIP/31207163645-00000003", "__INCOMINGCLI=0356*0004") in new stack
[2010-12-10 16:31:23] VERBOSE[25405] pbx.c: -- Executing [0356*0004@from-outside:3] Goto("SIP/31207163645-00000003", "from-outside-redir,0356*0004,1") in new stack
[2010-12-10 16:31:23] VERBOSE[25405] pbx.c: -- Goto (from-outside-redir,0356*0004,1)
[2010-12-10 16:31:23] VERBOSE[25405] pbx.c: -- Sent into invalid extension '0356*0004' in context 'from-outside-redir' on SIP/31207163645-00000003
[2010-12-10 16:31:23] VERBOSE[25405] pbx.c: -- Executing [i@from-outside-redir:1] Progress("SIP/31207163645-00000003", "") in new stack
[2010-12-10 16:31:23] VERBOSE[25405] pbx.c: -- Executing [i@from-outside-redir:2] Wait("SIP/31207163645-00000003", ".5") in new stack
[2010-12-10 16:31:24] VERBOSE[25405] pbx.c: -- Executing [i@from-outside-redir:3] Zapateller("SIP/31207163645-00000003", "") in new stack
[2010-12-10 16:31:26] VERBOSE[25405] pbx.c: -- Executing [i@from-outside-redir:4] Playback("SIP/31207163645-00000003", "discon-or-out-of-service,noanswer") in new stack
[2010-12-10 16:31:26] WARNING[25405] file.c: File discon-or-out-of-service does not exist in any format
[2010-12-10 16:31:26] WARNING[25405] file.c: Unable to open discon-or-out-of-service (format 0x4 (ulaw)): No such file or directory
[2010-12-10 16:31:26] WARNING[25405] app_playback.c: ast_streamfile failed on SIP/31207163645-00000003 for discon-or-out-of-service,noanswer
[2010-12-10 16:31:26] VERBOSE[25405] pbx.c: -- Executing [i@from-outside-redir:5] Wait("SIP/31207163645-00000003", "1") in new stack
[2010-12-10 16:31:27] VERBOSE[25405] pbx.c: -- Executing [i@from-outside-redir:6] Hangup("SIP/31207163645-00000003", "1") in new stack

Submitted by eeman on Fri, 12/10/2010 Permalink

you still are not directing the call to this context.. which means your trunk is not set up correctly.

in [general] section of sip.conf make sure allowguest=no

Submitted by hmelgers on Fri, 12/10/2010 Permalink

It is (was) set to no
When im looking at the trunk settings username and Caller ID are set to "0356", looks like the form lost the *0004 ie having problems too with the "*". Could that be the problem?

Submitted by eeman on Fri, 12/10/2010 Permalink

your CLI output never shows any evidence what so ever that your call went into custom-get-did-from-sip, which means you didnt change your trunk. perhaps you should paste the contents of the sip.conf entry for [31207163645] .. did you reload after making your changes?

Submitted by hmelgers on Fri, 12/10/2010 Permalink

My bad, only set it as the default context while the trunk was already made.

Some progress:
[2010-12-10 17:45:15] VERBOSE[30329] pbx.c: -- Executing [0356*0004@custom-get-did-from-sip:1] NoOp("SIP/31207163645-00000001", "Fixing DID using information from SIP TO header") in new stack
[2010-12-10 17:45:15] VERBOSE[30329] pbx.c: -- Executing [0356*0004@custom-get-did-from-sip:2] Set("SIP/31207163645-00000001", "pseudodid=") in new stack
[2010-12-10 17:45:15] VERBOSE[30329] pbx.c: -- Executing [0356*0004@custom-get-did-from-sip:3] Set("SIP/31207163645-00000001", "pseudodid=") in new stack
[2010-12-10 17:45:15] VERBOSE[30329] pbx.c: -- Executing [0356*0004@custom-get-did-from-sip:4] Goto("SIP/31207163645-00000001", "from-outside,,1") in new stack
[2010-12-10 17:45:15] VERBOSE[30329] pbx.c: -- Goto (from-outside,0356*0004,1)

But how to just remove that "*" ? apparently something goes wrong there.

Submitted by hmelgers on Mon, 12/13/2010 Permalink

ok, got it working, just came down to a faulty CUT. This works:

[custom-get-did-from-sip]

exten => _X.,1,Noop(Fixing DID using information from SIP TO header)
exten => _X.,n,NOOP(Header is: ${SIP_HEADER(TO)})
exten => _X.,n,Set(pseudodid=${SIP_HEADER(TO)})
exten => _X.,n,Set(pseudodid=${CUT(pseudodid,@,1)})
exten => _X.,n,Set(pseudodid=${CUT(pseudodid,:,2)})
exten => _X.,n,Noop(Pseudo is: ${pseudodid})
exten => _X.,n,Set(pseudodid=${pseudodid:0:4}${pseudodid:5})
exten => _X.,n,Noop(Pseudo is: ${pseudodid})
exten => _X.,n,Goto(from-outside,${pseudodid},1)

Submitted by hmelgers on Mon, 12/13/2010 Permalink

I know, we've seen more problems with other systems. They're using the voipnow system and somehow everything is build on that 0000*0000 format.

So, in TL i have to make a did without the asterisk, route incoming to the script to get rid of it and then it works. Not convenient if you have many different trunks as you always have to edit the sip.conf.