We help IT Professionals succeed at work.

asterisk callid vs uniqueid

Last Modified: 2014-10-01
We have written a softphone in VB.NET that connects to a Asterisk PBX.  In looking at the asterisk database, I see that there is a UNIQUEID for each call.  But SIP seems to use a CALLID field as the key value for calls.

Does anyone know of a way to convert a UNIQUEUID to a CALLID or visa versa?  Or is there a what to have the UNIQUEID passed in the SIP message?  Or CALLID stored in the Asterisk Database?

Thanks in advance
Watch Question

Ron MalmsteadInformation Services Manager

Take a look at SipAddHeader, if you want to place additional info in the sip message.



I tried something similar to that, but it doesn't seem to work when you are using SIP connections, only when you are dealing with Asterisk directly..
Ron MalmsteadInformation Services Manager

A SIP channel has a variable.. ${SIPCALLID}
This is the "Call-ID:"  in the Sip Header message.
You can access it in the dialplan to store it in the DB.

Additionally you have the ${UNIQUEID}, which is the current call id.

You could possibly combine these two into the Asterisk DB..
For example..   Set(__ConversationID=${SIPCALLID}-${UNIQUEID}), or place them in seperate columns for query purposes.

Otherwise, SipAddHeader() is the only way I'm aware of to introduce extra information into the Sip Header message.
I believe this only comes accross on the initial INVITE message though.


I am not sure I follow.  I am still pretty new to Asterisk.  Is that something I could force into the SIP header so that the UniqueID would be returned?

I am using a 3rd party control (ozeki) to handle the communicate with the PBX via SIP/UDP, so I don't know if the commands that are in the link you sent will work?
Ron MalmsteadInformation Services Manager

In your dialplan.. you would have something like this..

exten => _1XXX,1,SIPAddHeader(X-UNIQUE-ID: ${UNIQUEID})
exten => _1XXX,n,Dial(SIP/${EXTEN})
..then in your sip phone application, you would need to examine the first sip INVITE message.. to get the information.


Thanks for all the info.  How do I modify a dialplan on the Asterisk box.  Would I add those lines to the extensions.conf or something?
Information Services Manager
This one is on us!
(Get your first solution completely free - no credit card required)


Thanks for all the info...
how can i get SIP Header info in Ozeki C# SIP SDK?

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.