Issues With Twilio Number Incoming Call And Context Matching

Home » Asterisk Users » Issues With Twilio Number Incoming Call And Context Matching
Asterisk Users 6 Comments

Hello,

I am running Asterisk 13.6.0 in an AWS instance, and I set it up with Twilio SIP trunk using pjsip_wizard.conf (nice feature!). I see that the calls actually “reach” the PBX, but for some reason, they are not caught by any of my extensions context.

Here’s what I observe when I test this from a non-PBX connected E164 number
(a landline), say 555-666-1212. My Twilio number is 777-555-1212

Situation 1:
========extensions.conf:

[from-external]
exten => _.,1,Log(WARNING, TWILIO)

[from-internal]

Calling 555-666-1212 to Twilio number 777-555-1212:

On Asterisk CLI (core set debug on, logger set level WARNING on):

No logs at all. Call just ends. No friendly message saying why it will hangup.

Situation 2:
==========extensions.conf:

[from-external]

exten => 17775551212,1,Log(WARNING, TWILIO)
same => n,Hangup()

On Asterisk CLI:
Call from ‘from-twilio’ (UDP:mysillyapp.pstn.twilio.com:5060) to extension
‘+17775551212’ rejected because extension not found in context
‘from-external’.

However, clearly, the extension is there (in extensions.conf). The call hangs up, but with Twilio’s “The number you dialed is not a working number….” message.

What am I missing here? How do I fix this issue with the call not being
“caught” with my extensions.conf?

Any help is appreciated.

6 thoughts on - Issues With Twilio Number Incoming Call And Context Matching

  • Hello,

    try to change:

    exten => 17775551212,1,Log(WARNING, TWILIO)
    same => n,Hangup()

    with:

    exten => +17775551212,1,Log(WARNING, TWILIO)
    same => n,Hangup()

    Regards

  • Yes, I have tried that too (i.e, exten => +17775551212,1,Log(WARNING, TWILIO)). It does not work and NO error message in CLI.

    I have also tried http://orourketech.com/elastix-plus-sign-caller-id-messing-things/ since I
    first emailed this group, but that does not seem to work either.

    Here is my log:

    [Dec 2 15:09:28] NOTICE[26464]: res_pjsip_session.c:1920 new_invite: Call from ‘from-twilio’ (UDP:mysillyApp.pstn.twilio.com:5060) to extension
    ‘+17775551212’ rejected because extension not found in context
    ‘from-twilio-remove-plus’.
    [Dec 2 15:09:29] NOTICE[26464]: res_pjsip_session.c:1920 new_invite: Call from ‘from-twilio’ (UDP:mysillyApp.pstn.twilio.com:5060) to extension
    ‘+17775551212’ rejected because extension not found in context
    ‘from-twilio-remove-plus’. ip-xxxx*CLI> dialplan show from-twilio-remove-plus
    [ Context ‘from-twilio-remove-plus’ created by ‘pbx_config’ ]
    ‘_[+1]XXXXXXXXXX’ => 1. GotoIf($[“${CALLERID(num):0:2}” !”+1″]?noplusatstart) [pbx_config]
    2. Log(WARNING,TWILIO)
    [pbx_config]
    3. Set(CALLERID(num)=${CALLERID(num):1})
    [pbx_config]
    [noplusatstart] 4. Goto(from-external,${EXTEN},1)
    [pbx_config]
    ip-xxxx*CLI> dialplan show from-external
    [ Context ‘from-external’ created by ‘pbx_config’ ]
    ‘17775551212’ => 1. Log(WARNING,TWILIO)
    [pbx_config]
    2. Hangup()
    [pbx_config]

  • Maybe is because now it’s a different context:

    from-twilio-remove-plus

    before

    from-internal

    is right?

    regards

    El 02/12/2015 a las 10:22, Sonny Rajagopalan escribi

  • Hi

    Your extensions.conf should have +17775551212 extension and not 17775551212

    Add + sign before your number. This should solve your issue.

    [from-external]
    exten => +17775551212,1,Log(WARNING, TWILIO)
    same => n,Hangup()

    *Thanks & Regards,*
    Amit Patkar

  • Thanks Annus, Amit.

    Yes, Amit, the plus sign in front is necessary. I was able to get this to work by changing the codecs that the SIP trunk will use. I had to set up wireshark on my Asterisk instance, gather that it didn’t work for a 488 SIP
    “No acceptable here” message, which led me to discovering the codec problem.