Request-URI not avaiable using channel function

#1

Hi guys I’m trying to read the Request-URI header using the channel function but seems not be working. using PJSIP works but issue is that it give the URI as user/host, so I’m trying to see if using chan_sip I can get exactly as it is on the INVITE

same=>n,NoOP(${CHANNEL(ruri)})

[Apr 8 23:10:18] WARNING[18594][C-00000006]: func_channel.c:450 func_channel_read: Unknown or unavailable item requested: ‘ruri’

0 Likes

#2

Hi,

Use below function.

same => n,Noop(${CHANNEL(uri)})

You will get the output like: sip:1001@x.x.x.x:54058

0 Likes

#3

ruri documented on the Asterisk WIKI, as :

*** ruri - R/O Get the Request-URI from the INVITE header.** so it is not the same as uri

0 Likes

#4

I think the uri variable is the URI to access the peer, e.g. the contents of the Contact header received.

0 Likes

#5

My initial question is why item ruri is not available on the CHANNEL function ? if the value present on the INVITE request. The value I was trying to get usin ruri is the Request-Line-URI

0 Likes

#6

Your initial post is slightly confusing. Are you referring to chan_sip or chan_pjsip?

0 Likes

#7

Sorry @jcolp I tested pjsip and it works fine but information is returned in the format user/host so I switched to chan_sip to see if is returned as it is on the INVITE request, and tried the ruri item, and then is is when i get the following error

[Apr 8 23:10:18] WARNING[18594][C-00000006]: func_channel.c:450 func_channel_read: Unknown or unavailable item requested: ‘ruri’

and as I said before this item should be avaiable because it is on the INVITE and it is also docummented on the WIKI

0 Likes

#8

Looking at chan_sip (:scream:), it’s there:

	} else if (!strcasecmp(args.param, "ruri")) {
		char *tmpruri = REQ_OFFSET_TO_STR(&p->initreq, rlpart2);
		ast_copy_string(buf, tmpruri, buflen);

So I’m not entirely sure what’s up. The error you’re getting is what I would assume you would see if you invoked CHANNEL on a non-chan_sip channel…

0 Likes

#9

Hi @mjordan , Thank you for taking your time and review issue , This is a regular SIP call using a SIP client the uri value is present but not the ruri, Anyway I discarded the use of that value because was trying to get the Request-Line-URI value, I used PJSIP before but it return the value stricly user/host that’s why I tested with chan_sip but same result, and I know that it is need source code modification in order to get the value exactly as it is on INVITE request, I’m done thanks again guys for your time

0 Likes