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
On Fri, Jun 12, 2015 at 11:23 AM, D'Arcy J.M. Cain <darcy at vex.net>
wrote:
> 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=Candace <5555551212>
> mailbox=foobar2 at LocalSets
>
> So the caller ID is 5555551212 but the voice mail is foobar2. Is there
> any way to get the actual extension that called? Can I create a
> variable in the extension that I can read instead of ${CALLERID(num)}?
> I tried setting a random string (xaccount) and reading it with
> ${ENV(xaccount)} but it's not an environment variable and didn't
work.
>
> Cheers.
>
> --
> D'Arcy J.M. Cain
> System Administrator, Vex.Net
> http://www.Vex.Net/ IM:darcy at Vex.Net
> VoIP: sip:darcy at Vex.Net
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
> http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
--
A human being should be able to change a diaper, plan an invasion, butcher
a hog, conn a ship, design a building, write a sonnet, balance accounts,
build a wall, set a bone, comfort the dying, take orders, give orders,
cooperate, act alone, solve equations, analyze a new problem, pitch manure,
program a computer, cook a tasty meal, fight efficiently, die gallantly.
Specialization is for insects.
---Heinlein
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.digium.com/pipermail/asterisk-users/attachments/20150612/987caac7/attachment.html>