Intercom using PJSIP and multiple phones

Community based support for the Digium Phone Application Programming Interface (API).

Moderators: jwitt, sruffell, malcolmd, Moderator

Intercom using PJSIP and multiple phones

Postby lacymoore » Tue Jul 28, 2015 4:15 pm

I understand that the following code will do an intercom:
Code: Select all
exten => 100,1,Dial(PJSIP/alice,,b(pagehandler^addheader^1))

[pagehandler]
exten => addheader,1,Set(PJSIP_HEADER(add,Alert-Info)=<ring-answer>)

That works fine, but what if we have multiple phones registered to the alice line and are using
Code: Select all
exten => 100,1,Dial(${PJSIP_DIAL_CONTACTS(alice)},,b(pagehandler^addheader^1))

[pagehandler]
exten => addheader,1,Set(PJSIP_HEADER(add,Alert-Info)=<ring-answer>)

That will only intercom with one of the phones. Is it possible to break out the PJSIP_DIAL_CONTACTS to add the header to each one? If so, I'm just not seeing how to do this.
lacymoore
Oldsterisk
 
Posts: 81
Joined: Thu Dec 21, 2006 10:56 pm

Re: Intercom using PJSIP and multiple phones

Postby lacymoore » Tue Jul 28, 2015 8:41 pm

I've worked on this a little more. I've got some manual things down. For example:

Code: Select all
[Dial-Users]
exten => 129,1,NoOp
   same => n,NoOp(${PJSIP_DIAL_CONTACTS(${EXTEN})})
   same => n,Page(Local/1@page-129&Local/2@page-129)

[page-129]
exten => 1,1,Dial(PJSIP/129/sip:129@192.168.93.103:5060,,b(handler-intercom^addheader^1))
exten => 2,1,Dial(PJSIP/129/sip:129@192.168.93.230:5060,,b(handler-intercom^addheader^1))

[handler-intercom]
exten => addheader,1,Set(PJSIP_HEADER(add,Alert-Info)=<ring-answer>)

Obviously this only works because I (a) know what phones have line 129 registered and (b) know the IP address of the phones.

In my NoOp command, I can see the extensions and I know enough about variables to be able to extract them, but I don't know how to convert that into dial statements. If I were to guess, real-time would have to be used here.

I hope that I'm going down the wrong path and there is something I'm missing that makes this easier, or maybe it's just not possible at this time.

Of course, I may be completely offbase on my use case for this. I haven't thought that part through yet. In the end, I may not NEED to do this, but I'd still like to know how. You never know what the future brings.
lacymoore
Oldsterisk
 
Posts: 81
Joined: Thu Dec 21, 2006 10:56 pm


Return to Digium Phone API

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest