Voice Mail And Caller ID

Home » Asterisk Users » Voice Mail And Caller ID
Asterisk Users 3 Comments

I have this in my sip.conf:

exten => *98,1,Verbose(0,CALLERID number is “${CALLERID(num)}”)
same => n,VoicemailMain(${CALLERID(num)}@LocalSets,s)
same => n,Hangup

However, my extensions are set up so that they always show the external number, not the extension:

[foobar2](client-phone)
secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx callerid

3 thoughts on - Voice Mail And Caller ID

  • Try this for CHAN_SIP:

    same => n,Set(Peer=${SIPCHANINFO(peername)}) ; Get the peer same => n,Set(MailBox=${SIPPEER(${Peer},mailbox)}); Get the mailbox same => n,VoicemailMain(${MailBox}@LocalSets,s) ; If we have a mailbox defined log into it

    If you are using PJSIP it’s more complex same => n,Set(EndPoint=${CHANNEL(endpoint)}) ; Get the peer same => n,Set(MailBox=${PJSIP_ENDPOINT(${EndPoint},mailboxes)})
    same => n,ExecIf($[${ISNULL(${MailBox})} 1]?Set(MailBox=${AST_SORCERY(res_pjsip,aor,${EndPoint},mailboxes)}))
    same => n,VoicemailMain(${MailBox}@LocalSets,s) ; If we have a mailbox defined log into it

  • Perfect. Thanks. However, I didn’t bother setting a variable. I just use it directly.

    same => n,VoicemailMain(${SIPCHANINFO(peername)}@LocalSets,s)

    However…

    http://www.voip-info.org/wiki/view/Asterisk+func+sipchaninfo says that SIPCHANINFO is deprecated and that we should use CHANNEL instead. I
    tried that and it said “pbx.c: Function CHANNEL not registered”. Does that mean that this solution will eventually fail when SIPCHANINFO is removed in some future release? I am running 11.17.1.

    Cheers.