Pull a variable from the SIP Header

<--- SIP read from UDP: --->
SIP/2.0 200 OK
From: <sip:2222222222@hostname>;tag=as1e1c4c0f
Supported: INVITE
Call-ID: c6b3e3fcc0441e8aff00c2gsdga8d
Via: SIP/2.0/UDP;branch=z9hG4bK46fa9164;rport=5060
Av-Global-Session-ID: c6b3dsgrsegrfcf4-c0srgersg04-41esrgsr8-afsgsgrded-00regeagfgaga
Server: Avaya CM AVAYA-SM
To: "Test" <sip:1111111111@hostname>;tag=c6b3e3fcc0441e8aff00c2gsdga8d
Content-Length: 0

The above is just an example, but I am getting similar SIP messaging. My goal is to pull the “Call-ID” field, I would like to grab and store the value as a variable ($ACUID) for the current call. I want to route based on the data I receive.

I believe I can do this with the sip_header command from the dial plan, but am not sure where to go from there.

This is all a little new to me. I was hoping someone could help guide me

exten => 100,1,NoOp(ID is ${SIP_HEADER(Call-ID)})


Note that Call-ID has no semantics other than it should be unique across all SIP calls. If you are routing based on it, you are almost certainly reading into it more than is actually guaranteed.