From acec80a2b82e41f0c22c756efa18453279ced68d Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Wed, 18 Apr 2012 13:25:49 +0200 Subject: [PATCH] mobile-push: b/f: reply only once with FR to INVITE --- apps/mobile_push/mobile_push.dsm | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/apps/mobile_push/mobile_push.dsm b/apps/mobile_push/mobile_push.dsm index 77dfe801..c1560592 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 / {