How to detect if an extension is calling itself

What variable can I use in a calling plan to determine the extension that is placing a call? I’d like to compare this variable to the extension being dialed to determine if an extension is trying to call itself. If so, I’d like to route the call to VoiceMailMain instead of ringing itself.

To be more specific, the Polycom soundpoint phones dial their own line when you press the Messages button. I’d like to write a dialplan that will “do the right thing” when this occurs.

Thanks,
mike

You can use the ChanIsAvail function to see if the channel is
available before making a call.

But this is not specific to your problem. By that I mean the channel
could not be available for a number of reasons and one of them could
be what you have mentioned.

That’s an interesting idea, but as you point out, I don’t think the test is specific enough. It would not distinguish between a channel calling itself and another channel trying to call an extension while the extension was in use.

Clearly the SIP module knows what channel is placing a call. I thought this information might be available through one of the SIP variables, but none of them seem quite right for the job.

Can SIPGetHeader() be used in some fashion to solve my problem? I’m not familiar with the SIP headers.

Using SIPGetHeader() or a SIP variable limits my logic to SIP channels, which isn’t a flexible solution, but it would meet my immediate needs.

mike

im 99% sure the polycoms can be reprogrammed to dial something else. try adding vmexten= to sip.conf, that may fix it. Or try to dig up a pcom admin guide… This should be your 1st step.

also, the variable ${CHANNEL} contains the name of the current channel, I believe in the format TYPE/PEER-code. For SIP channels you could use ${CHANNEL:4:x} (replace x with the length of your extensions), then use GotoIf to see if ${CHANNEL:4:x} = ${EXTEN}.

If the phones send their correct callerid, you could use gotoif to see if ${CALLERIDNUM} = ${EXTEN}…

Thanks. Using ${CHANNEL} works. I’ve got things configured to use names as extensions instead of numbers, so I can’t just use the first N characters of ${CHANNEL}, but Cut() works very well. Cut(CHAN=CHANNEL,-,1) gives me exactly what I need.

mike

Or, you can change your Polycom configuration so that the phones don’t dial themselves. In phone1.cfg (or equivalent):

<mwi msg.mwi.1.subscribe="401" msg.mwi.1.callBackMode="contact" msg.mwi.1.callBack="*97"/>

Essentially, change callBackMode from registration to contact and provide the callBack number.