Hello,
Say I have something like the following:
$avp(a[0]) = "27*" $avp(a[1]) = "22*"
Then I run avp_substr like the following: avp_subst("$avp(a)/g", "/*/[0-9]/g");
As you would expect it to simply strip * from the avp list values, instead it decides to rewrite the index in numerical order, so the avp's would now look like:
[ BAD RESULTS ] $avp(a[0]) = "22"; $avp(a[1]) = "27";
however the [ EXPECTED RESULTS ] $avp(a[0]) = "27"; $avp(a[1]) = "22";
Could someone please elaborate on why OpenSER would re-numerate the list index on a simple avp_substr, also any ideas on how I can get around this and stop this from happening? Thanks!
Hi all,
I wish to get from the script the number of Record-Route, Via headers, Contact (in the order they appear of course...)
Additionnaly, I would be interested to "read" them. To me, it look like the search() can't be used for this?
I searched the doc and google, but could not find any tips for this specific operation.
tks, Aymeric MOIZARD / ANTISIP amsip - http://www.antisip.com osip2 - http://www.osip.org eXosip2 - http://savannah.nongnu.org/projects/exosip/
Hello,
to get the number of the headers is not very easy. There might be a possibility to use recursive routes, but it is quite complex. I have to think about. This might be a useful tool in the config, if the time will allow, next stable version will have such feature.
However, it is possible to read a header by index
$hdr(Via[1]) is the second via header. If the header at that index does not exists, you will get null.
http://openser.org/dokuwiki/doku.php/pseudovariables:1.2.x#headers
Cheers, Daniel
On 08/31/07 17:16, Aymeric Moizard wrote:
Hello,
internally, the avp list acts as a stack. When you add a new one, it will be the first.
What happens when you operate over the whole array of AVPs, you delete as you go in list, and add at the top. So, the last in the initial list that was process, will become the first.
Maybe renaming them once again is the workaround for now.
Cheers, Daniel
On 08/31/07 15:32, Brandon Armstead wrote: