Module: sems
Branch: master
Commit: dc9c524b88d9963358329927eb1105005b8b142a
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=dc9c524b88d9963358329927eb1105005b8b142a

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Wed Apr 18 13:25:49 2012 +0200

mobile-push: b/f: reply only once with FR to INVITE

---

 apps/mobile_push/mobile_push.dsm |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/apps/mobile_push/mobile_push.dsm b/apps/mobile_push/mobile_push.dsm
index 77dfe80..c156059 100644
--- a/apps/mobile_push/mobile_push.dsm
+++ b/apps/mobile_push/mobile_push.dsm
@@ -139,10 +139,21 @@ function releaseRegEvalObjects() {
 };
 
 function replyWith300() {
-  set($dlg.reply.hdrs="Contact: ");
-  append($dlg.reply.hdrs, @local_uri);
-  append($dlg.reply.hdrs, $config.extra_3xx_uri_append);
-  dlg.reply(300, "Multiple Choices");
+  if test($has_replied!="yes") {
+    set($dlg.reply.hdrs="Contact: ");
+    append($dlg.reply.hdrs, @local_uri);
+    append($dlg.reply.hdrs, $config.extra_3xx_uri_append);
+    dlg.reply(300, "Multiple Choices");
+    set($has_replied="yes");
+  }
+  stop(false);
+};
+
+function replyWith480() {
+  if test($has_replied!="yes") {
+    dlg.reply(480, "Not found");
+    set($has_replied="yes");
+  }
   stop(false);
 };
 
@@ -152,7 +163,6 @@ transition "NOTIFY received, with body" WAITING - 
subscription(#status!="termina
   if test($active_contacts != 0) {
     replyWith300();
     subscription.remove($r.handle);
-    stop(false);
   }
 
   releaseRegEvalObjects();
@@ -169,21 +179,18 @@ transition "NOTIFY received, terminated (but with body)" 
WAITING - subscription(
   if test($active_contacts != 0) {
     replyWith300();
   } else {
-    dlg.reply(480, "Not found");
+    replyWith480();
   }
   releaseRegEvalObjects();
-  stop(false);
 } -> END;
 
 transition "NOTIFY received, subscription terminated" WAITING - 
subscription(#status=="terminated") / {
-  dlg.reply(480, "Not found");
-  stop(false);
+  replyWith480();
 } -> END;
 
 transition "timer hit" WAITING - timer(#id==1) / {
   subscription.remove($r.handle);
-  dlg.reply(480, "Not found");
-  stop(false);
+  replyWith480();
 } -> END;
 
 transition "CANCEL received" WAITING - hangup / {

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to