Extract Call ID header in SIP invite

Status
Not open for further replies.

Dee

Member
Jun 7, 2019
50
3
8
35
Hello - Is there a way to extract the Call ID information in a sip invite.

I want to use this information in a custom dial plan but I cannot seem to find a freeswitch variable to extract the CALL- ID.

Any thoughts?




2021/11/9 14:27:05.420600 10.0.0.58:5060 -> 10.0.0.59:5060
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 10.0.0.59;branch=z9hG4bK3939fb399A0A48B0;rport=5060
From: "K" <sip:100@pbx.lan>;tag=A18A00E3-ED5D3862
To: <sip:101@pbx.lan>;tag=0cQ88rIFk2B7
Call-ID: 8b96186806bbfb5bbbcd803885738c37
CSeq: 37 SUBSCRIBE
User-Agent: FreeSWITCH
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, messa
-summary, refer
Proxy-Authenticate: Digest realm="pbx.lan", nonce="a481e89a-65bd-49b2-b5f4-e1aff9a8411a", algorithm=MD5, qop="auth"
Content-Length: 0
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,044
565
113
Just execute the dialplan app info, that will dump all the vars out for you
 

Dee

Member
Jun 7, 2019
50
3
8
35
Thanks- sip_call_id is given me a different data and not picking up the call-id in the sip invite.

As you suggested- i am using -- callid=${sip_call_id} but it is picking up a different value
 

Attachments

  • Screenshot 2022-02-13 at 14.47.58.png
    Screenshot 2022-02-13 at 14.47.58.png
    53.5 KB · Views: 20
  • Screenshot 2022-02-13 at 14.47.53.png
    Screenshot 2022-02-13 at 14.47.53.png
    9.4 KB · Views: 19

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,415
376
83
I believe what is shown in the CDR is the sip_call_id for the A-leg of the call. As FusionPBX (FreeSWITCH) is a back to back user agent (B2BUA) there will be a different sip_call_id on the B-leg. I don't believe it is possible to get the B-leg sip_call_id within the dial plan.
 

Dee

Member
Jun 7, 2019
50
3
8
35
Thanks for replying. i have tried all sort of variable and the sip is different as you mentioned.

I would have thought the sip invite is saved somewhere in the data base and you should be able to pick it up.
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,415
376
83
Thanks for replying. i have tried all sort of variable and the sip is different as you mentioned.

I would have thought the sip invite is saved somewhere in the data base and you should be able to pick it up.
I'm sure it can be captured in the DB one way or another, I seem to remember reading something about [enabling] B-leg channel variables and XML_CDR somewhere on the FreeSWITCH website, but I can't remember off the top of my head. I'll post back if I get time to look, likewise let me know if you get anywhere with this.

Adrian.
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,044
565
113
The info app can be just dropped in anywhere, obviously, you will need it in the right place, in the gui it looks like:
appinfo.png

The in fs_cli you should see all the variables available with values so if you can see your value, you should be able to see the relevant variable name.
 

Dee

Member
Jun 7, 2019
50
3
8
35
Finally found the solution -- I basically passed the uuid of the a leg to become the Call-ID of the sip invite by adding

action. export sip_h_call-id={uuid}

Now Call-ID is the same as uuid

Thanks for your help all
 
  • Like
Reactions: Adrian Fretwell

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,415
376
83
Just came across this whilst researching something else, just adding for completeness...

From the FreeSWITCH Documentation: https://freeswitch.org/confluence/display/FREESWITCH/Sofia+Configuration+Files

Call ID​

inbound-use-callid-as-uuid​

On inbound calls make the uuid of the session equal to the SIP call id of that call.

<param name="inbound-use-callid-as-uuid" value="true"/>

outbound-use-uuid-as-callid​

On outbound calls set the callid to match the uuid of the session

<param name="outbound-use-uuid-as-callid" value="true"/>

This goes in the "..sip_profiles/external.xml" file.
 
Status
Not open for further replies.