Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- route[route_to_user]
- {
- t_on_failure("missed_call");
- $var(session)= $hdr(p-hint);
- #rest_append_hf("Session: 5a6f49205f4074103e8e7560");
- #rest_post("http://$avp(api)/v2/cc/push/$ci/$fU/$tU", "", "application/json", "$var(body)", "$var(ct)", "$var(rcode)");
- $var(user) = $fU;
- $avp(env3) = "";
- $var(input3) ="callid="+$ci+" environment="+$hdr(environment)+" fromuser="+$var(user)+" touser="+$tU+" session="+$var(session);
- xlog("exec post being executed $var(input3)\n");
- exec("php /etc/opensips/postpush.php $var(input3)", ,"$var(outinvite2)", "$var(err)", "$avp(env3) ");
- t_newtran();
- t_wait_for_new_branches();
- $avp(filter) = "aor="+$rU;
- notify_on_event("E_UL_CONTACT_INSERT","$avp(filter)", "fork_call", "15");
- if (lookup("location")){
- # route(relay);
- xlog("the first contact is of the following transport $rP with the q value of : $ru_q \n");
- if($rP == "ws"){
- $ru_q = 1000;
- xlog("first contact for $ru is now $ru_q \n");
- }
- $var(i) = 0;
- #while ($var(i) < 4 || $(branch(uri)[$var(i)]) != null) {
- while ($(branch(uri)[$var(i)]) != null) {
- #while ($var(i) < 4){
- xlog("$$(branch(uri)[$var(i)])=[$(branch(uri)[$var(i)])]\n");
- if ($(branch(uri)[$var(i)]{uri.transport}) == "ws" && !isbflagset(keepPW) ) {
- xlog(" ws branch found number $var(i) with URI=[$(branch(uri)[$var(i)])]\n");
- $(branch(q)[$var(i)]) = 1000;
- xlog("$(branch(q)[$var(i)]) confirming q value for branch $(branch(uri)[$var(i)])\n");
- } else {
- #$var(i) = $var(i) + 1;
- xlog("a sip branch will not given prorioty $(branch(uri)[$var(i)]{uri.transport})\n");
- xlog("hence this q value $(branch(q)[$var(i)])\n");
- }
- $var(i) = $var(i) + 1;
- }
- xlog("$(branch(uri)[*]) and $(branch(q)[*]) finished looping through all branches\n");
- if ($var(i) > 0){
- xlog("value of branch iterator $var(i)\n");
- }
- serialize_branches(1);
- next_branches();
- route(relay);
- }
- exit;
- }
- route[fork_call] {
- xlog("user $avp(aor) registered the a new contact $avp(uri), "
- "injecting it in transaction\n");
- # take the contact described by the E_UL_CONTACT_INSERT
- # event and inject it as a new branch into the original transaction
- t_inject_branches("event");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement