Thank you Daniel and Morten for your assistance and prompt reply.
To use the tobody transformation, i see that i would need to upgrade to 4.1 right? Im currently on 3.3.
$var(i)=0;
while($(hdr(Diversion)[$var(i)]) != $null ) {
$avp(s:divhdr) = $(hdr(Diversion)[$var(i)]);
avp_subst("$avp(s:divhdr)", "/.*sip:(.*)(@.*)/\1/");
xlog("L_WARN", "$avp(s:divhdr)");
if (!is_user_in("$avp(s:divhdr)", "7")) {
sl_send_reply("403", "NOT ALLOWED");
exit;
};
$var(i) = $var(i) +1;
}
However, it seems like group module cant parse the output 313 as seen below:
Apr 10 13:16:43 SipProxy-Test /usr/local/sbin/kamailio[7471]: WARNING: <script>: 313
Apr 10 13:16:43 SipProxy-Test /usr/local/sbin/kamailio[7471]: ERROR: group [group.c:114]: failed to parse URI <313>
Apr 10 13:16:43 SipProxy-Test /usr/local/sbin/kamailio[7471]: ERROR: group [group.c:158]: failed to get username@domain
A bigger issue is that a certain client is sending more than one diversion header with different format as seen below:
Diversion: <tel:22030009>;reason=no-answer;screen=no;privacy=off
So in this case i cant really know how to extract the diversion number using a static substitution. Is there a way to adapt to different formats to extract the diversion number?
Thanking you in advance
Phillip