Variable containing the current SIP login?

Hello Folks!

I am wondering if there is a variable created by asterisk and available in the dialplan, that would contain the SIP or IAX login of the phone currently dialing.

Here is why I’d need it. When dialing out, I want to set the outbound caller ID for our phones. Each phone has a 4-digit login that matches its DID. So when dialing out, I’d like to be able to write something like:


But I can’t seem to find if a variable like ${SIP_LOGIN} is created…

Thanks !

in the phone itself if you set its caller ID to the extension number of the phone you should be able to use the callerid variable in asterisk to do what you want to do… as the phone itself will pass through its extension number as callerid to asterisk… you can then prepend the NPA-NXX of the DID number to that (or write your own table)… and use setcallerid to pass this number on to the SIP telecom provider or PRI trunk

This is how I do it for SIP channels… not sure if there is actually a channel variable somewhere, but this works well for me.

exten => BLAH,1,Set(LocalUser=${CUT(CHANNEL,/,2)})
exten => BLAH,n,Set(LocalUser=${CUT(LocalUser,-,1)})


it would return “someuser”

Hi g2010!

Thanks very much for your post, this is exactly what i was looking for ! :smile: