<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:black;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:black;}
span.comment
{mso-style-name:comment;}
span.lineno
{mso-style-name:lineno;}
span.keywordflow
{mso-style-name:keywordflow;}
span.stringliteral
{mso-style-name:stringliteral;}
span.EmailStyle23
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:windowtext">Thanks Keith, that is helpful if we need to cancel a message.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">What I ended up with is NOT cancelling the event but modifying it to have the updated information it needs to route correctly. For inbound SMS messages, I just set the “to” value to a registered extension
and let the plan exit. The default handling is to then send it.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">For external (out to my VSP) I had to set several “fields”:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><img width="659" height="135" style="width:6.8645in;height:1.4062in" id="Picture_x0020_1" src="cid:image001.png@01D54F76.816FCA20"></span><span style="color:windowtext"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">Hope that helps others,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">Sean<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span style="color:windowtext"> k@rhizomatica.org <k@rhizomatica.org>
<br>
<b>Sent:</b> Saturday, August 10, 2019 7:56 AM<br>
<b>To:</b> FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org>; Sean Devoy <sdevoy@bizfocused.com><br>
<b>Subject:</b> Re: [Freeswitch-users] Chat Plan Handling<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><br>
On 08/08/2019 16:23, Sean Devoy wrote:<br>
><br>
> How can to stop the default handling of an inbound SMS message?<o:p></o:p></p>
<p>><o:p> </o:p></p>
<p><o:p> </o:p></p>
<p>Hi Sean, after some long time trying to do that, then giving up, and coming back to it, various times, I finally went for the source code with a comb and it seems I finally found a way to do it:<o:p></o:p></p>
<p>Please see. <a href="https://github.com/Rhizomatica/rccn/commit/db08b977711da1e09e3326db1723f6774a2b4e6c">
https://github.com/Rhizomatica/rccn/commit/db08b977711da1e09e3326db1723f6774a2b4e6c</a><o:p></o:p></p>
<p>Hmm, when making that commit, I referenced: <a href="https://docs.freeswitch.org/switch__loadable__module_8c.html#a6389148319476a6f9858ccf4b889f8a4">
https://docs.freeswitch.org/switch__loadable__module_8c.html#a6389148319476a6f9858ccf4b889f8a4</a><o:p></o:p></p>
<p>Which is where I found in this comment:<o:p></o:p></p>
<p><span class="comment">/* The event was handled by an extension in the chatplan,
</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span class="comment">* so the event will be duplicated, modified and queued again,
</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <span class="comment"> * but it won't be processed by the chatplan again.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <span class="comment"> * So this copy of the event can be destroyed by the caller.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <span class="comment"> */</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span class="comment">This is the condition for skipping the default handling:</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><br>
<span class="keywordflow">if</span><span class="comment"> (<a href="https://docs.freeswitch.org/switch__utils_8h.html#a890e4243bd6e31e6c68a83832da023a7">switch_true</a>(<a href="https://docs.freeswitch.org/group__events.html#ga5c3108ab2e8d73d8ef8e6c41224059aa">switch_event_get_header</a>(message_event,
</span><span class="stringliteral">"final_delivery"</span><span class="comment">))) {</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span class="comment"> do_skip = 1;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span class="comment">}</span><o:p></o:p></p>
</div>
<p><o:p> </o:p></p>
<p>so you need the final_delivery event header. Not sure how you add that in an XML dialplan, or in your implementation.<o:p></o:p></p>
<p>Maybe the python in github can give you some clues.<o:p></o:p></p>
<p>and no, stop and all that does not work - It only prevents the chatplan from execing applications. (IIUC)<o:p></o:p></p>
<p><o:p> </o:p></p>
<p>Cheers<o:p></o:p></p>
<p>Keith.<o:p></o:p></p>
<p><o:p> </o:p></p>
<p><o:p> </o:p></p>
</div>
</body>
</html>