Advertisement
Guest User

Untitled

a guest
Apr 16th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. route[route_to_user]
  2. {
  3.  
  4. t_on_failure("missed_call");
  5.  
  6.  
  7. $var(session)= $hdr(p-hint);
  8. #rest_append_hf("Session: 5a6f49205f4074103e8e7560");
  9.  
  10. #rest_post("http://$avp(api)/v2/cc/push/$ci/$fU/$tU", "", "application/json", "$var(body)", "$var(ct)", "$var(rcode)");
  11. $var(user) = $fU;
  12. $avp(env3) = "";
  13. $var(input3) ="callid="+$ci+" environment="+$hdr(environment)+" fromuser="+$var(user)+" touser="+$tU+" session="+$var(session);
  14.  
  15. xlog("exec post being executed $var(input3)\n");
  16. exec("php /etc/opensips/postpush.php $var(input3)", ,"$var(outinvite2)", "$var(err)", "$avp(env3) ");
  17.  
  18.  
  19. t_newtran();
  20.  
  21. t_wait_for_new_branches();
  22.  
  23. $avp(filter) = "aor="+$rU;
  24. notify_on_event("E_UL_CONTACT_INSERT","$avp(filter)", "fork_call", "15");
  25.  
  26. if (lookup("location")){
  27. # route(relay);
  28. xlog("the first contact is of the following transport $rP with the q value of : $ru_q \n");
  29. if($rP == "ws"){
  30. $ru_q = 1000;
  31. xlog("first contact for $ru is now $ru_q \n");
  32. }
  33.  
  34. $var(i) = 0;
  35.  
  36. #while ($var(i) < 4 || $(branch(uri)[$var(i)]) != null) {
  37. while ($(branch(uri)[$var(i)]) != null) {
  38. #while ($var(i) < 4){
  39. xlog("$$(branch(uri)[$var(i)])=[$(branch(uri)[$var(i)])]\n");
  40. if ($(branch(uri)[$var(i)]{uri.transport}) == "ws" && !isbflagset(keepPW) ) {
  41. xlog(" ws branch found number $var(i) with URI=[$(branch(uri)[$var(i)])]\n");
  42. $(branch(q)[$var(i)]) = 1000;
  43. xlog("$(branch(q)[$var(i)]) confirming q value for branch $(branch(uri)[$var(i)])\n");
  44.  
  45.  
  46. } else {
  47. #$var(i) = $var(i) + 1;
  48. xlog("a sip branch will not given prorioty $(branch(uri)[$var(i)]{uri.transport})\n");
  49. xlog("hence this q value $(branch(q)[$var(i)])\n");
  50. }
  51. $var(i) = $var(i) + 1;
  52.  
  53. }
  54. xlog("$(branch(uri)[*]) and $(branch(q)[*]) finished looping through all branches\n");
  55.  
  56. if ($var(i) > 0){
  57. xlog("value of branch iterator $var(i)\n");
  58. }
  59.  
  60. serialize_branches(1);
  61. next_branches();
  62. route(relay);
  63.  
  64. }
  65. exit;
  66. }
  67.  
  68.  
  69. route[fork_call] {
  70. xlog("user $avp(aor) registered the a new contact $avp(uri), "
  71. "injecting it in transaction\n");
  72. # take the contact described by the E_UL_CONTACT_INSERT
  73. # event and inject it as a new branch into the original transaction
  74.  
  75. t_inject_branches("event");
  76.  
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement