Possible Bug In Asterisk 16

Home » Asterisk Users » Possible Bug In Asterisk 16
Asterisk Users 2 Comments

Hello,

I am experiencing weird problem in Asterisk 16.2, possibly a bug. Same thing works fine in Asterisk 11. Here is the situation:

I have 2 extensions on 2 phones. 4 extensions in total.

phone 1:
8882
8382

phone 2:
8884
8384

And I have 2 SIP trunks for outgoing calls. I want to call via SIP1 when called via 8882 or 8884, and SIP2 when called via 8382 or 8384.

And one last detail. SIP1 has caller ID spoofing enabled (used for call forwarding), so for outgoing calls, I have to explicitly set caller ID, otherwise 8882/8884 would be shown.

Here is my config:

exten => _0XXXXXXXX./_888[24],1,Verbose(0,EXTERNAL CALL)
same => n,Macro(record)
same => n,Set(CALLERID(num)=0441111111)
same => n,DIAL(SIP/0441111111/${EXTEN})
same => n,Hangup()

exten => _0XXXXXXXX./_838[24],1,Verbose(0,EXTERNAL CALL)
same => n,Macro(record)
same => n,DIAL(SIP/0442222222/${EXTEN})
same => n,Hangup()

Now here the problem. The combination of /_888[24] and Set(CALLERID(num)=0441111111) causes problems:

sent to invalid extension but no invalid handler:
context,exten,priority=fullaccess,0793333333,4

When I comment the line Set(CALLERID, everything works. Or when i change the first line to:

exten => _0XXXXXXXX.,1,Verbose(0,EXTERNAL CALL)

Everything works as well. Only the combination of both
/_888[24] and Set(CALLERID(num)=0441111111) causes problems:

can anybody understand what is happening here ?

thanks,

2 thoughts on - Possible Bug In Asterisk 16

  • In article <4fb12839-c24c-bd27-51f9-2d85a4bffb75@gmx.ch>, Fourhundred Thecat <400thecat@gmx.ch> wrote:

    Yes, I think so. Let’s rewrite your first section as it is stored internally, without the “same” and “n” shortcuts:

    exten => _0XXXXXXXX./_888[24],1,Verbose(0,EXTERNAL CALL)
    exten => _0XXXXXXXX./_888[24],2,Macro(record)
    exten => _0XXXXXXXX./_888[24],3,Set(CALLERID(num)=0441111111)
    exten => _0XXXXXXXX./_888[24],4,DIAL(SIP/0441111111/${EXTEN})
    exten => _0XXXXXXXX./_888[24],5,Hangup()

    Notice that all steps match both destination number and source caller-ID. When you get to step 4, you have just changed the source caller-ID to
    0441111111, which no longer matches _888[24]

    If you did this instead, it should work:

    exten => _0XXXXXXXX./_888[24],1,Verbose(0,EXTERNAL CALL)
    same => n,Macro(record)
    same => n,Set(CALLERID(num)=0441111111)
    exten => _0XXXXXXXX./0441111111,n,DIAL(SIP/0441111111/${EXTEN})
    same => n,Hangup()

    I’ve just done the above on my Asterisk 16 box, and the loaded dialplan looks like this:

    hp3*CLI> dialplan show testing
    [ Context ‘testing’ created by ‘pbx_config’ ]
    ‘_0XXXXXXXX.’ (CID match ‘0441111111’) => 4. DIAL(SIP/0441111111/${EXTEN}) [extensions.conf:883]
    5. Hangup() [extensions.conf:884]
    ‘_0XXXXXXXX.’ (CID match ‘_888[24]’) => 1. Verbose(0,EXTERNAL CALL) [extensions.conf:880]
    2. Macro(record) [extensions.conf:881]
    3. Set(CALLERID(num)=0441111111) [extensions.conf:882]

    -= 2 extensions (5 priorities) in 1 context. =-

    Notice that the “n” converted to “4” correctly even though the extension changed. I wasn’t aware it would until I tried it.

    Why your original version works fine in Asterisk 11 I don’t know. Maybe the handling of caller-ID changed.

    Cheers Tony

    Tony Mountifield Work: tony@softins.co.ukhttp://www.softins.co.uk Play: tony@mountifield.orghttp://tony.mountifield.org