yeah, make sense. Ok, we will proceed exposing fake_reply in tm and start a new branch for everyone to review. Any tips on how to create a branch using GIT? ;) - I&#39;m paranoid of doing something wrong to git master ;)<br>
<br>Cheers<br>Jason<br><br><div class="gmail_quote">On Thu, Sep 29, 2011 at 5:05 PM, Timo Reimann <span dir="ltr">&lt;<a href="mailto:timo.reimann@1und1.de">timo.reimann@1und1.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hey Jason,<br>
<div class="im"><br>
<br>
On 29.09.2011 16:54, Jason Penton wrote:<br>
&gt; Awesome, thanks Timo. However, The example you give here is to store<br>
&gt; dlg_cell in transaction. Actually, we are using the reverse, se pseudo<br>
&gt; code below:<br>
&gt;<br>
&gt; when INVITE req_forwarded callback is called, create dialog_in<br>
&gt; structure, link and store pointer to transaction in dlg_cell<br>
&gt; if we get a request to terminate dialog that is unconfirmed we get the<br>
&gt; transaction ptr from dlg_cell and traverse through branches, sending<br>
&gt; fake_reply (480/408/x).<br>
<br>
</div>Dialogs aren&#39;t stored in transactions, they are stored (hackishly) in<br>
transaction callbacks (better: attached to them). But anyways, I think<br>
the uses-relationships are similar in both cases: The dialog module is<br>
called and needs to refer to its transaction. The current module&#39;s<br>
pseudo-code:<br>
<br>
&quot;When INVITE on_create callback is called: create dialog structure, link<br>
and store pointer to transaction in tm callback.<br>
If we a response, fetch the transaction ptr from the tm callback to<br>
allow access to dialog variables.&quot;<br>
<br>
AFAICS, all that differs is the location of the transaction pointer<br>
which is currently stored in a tm callback (bad) while you use the<br>
dialog structure (good). Let me know if I get things wrong.<br>
<br>
<br>
Cheers,<br>
<font color="#888888"><br>
--Timo<br>
</font><div class="im"><br>
<br>
<br>
&gt; On Thu, Sep 29, 2011 at 4:34 PM, Timo Reimann &lt;<a href="mailto:timo.reimann@1und1.de">timo.reimann@1und1.de</a><br>
</div><div><div></div><div class="h5">&gt; &lt;mailto:<a href="mailto:timo.reimann@1und1.de">timo.reimann@1und1.de</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     Hi Jason,<br>
&gt;<br>
&gt;<br>
&gt;     On 29.09.2011 16:06, Jason Penton wrote:<br>
&gt;     &gt; Ok Dialog2 progressing nicely. We now have dialogs and their<br>
&gt;     associated<br>
&gt;     &gt; out dialogs (branches / forking) stored and managed within the dialog2<br>
&gt;     &gt; module. For the moment, we have excluded DB support but will add<br>
&gt;     once we<br>
&gt;     &gt; check in to git. One thing we need a little assistance with:<br>
&gt;     &gt;<br>
&gt;     &gt; We have just finished the prototype for proxy initiated early dialog<br>
&gt;     &gt; termination, but we are concerned with the way it has been done.<br>
&gt;     &gt; Basically as mentioned in the wiki<br>
&gt;     &gt;<br>
&gt;     (<a href="http://www.kamailio.org/dokuwiki/doku.php/modules-new-design:dialog-module-design" target="_blank">http://www.kamailio.org/dokuwiki/doku.php/modules-new-design:dialog-module-design</a>),<br>
&gt;     &gt;<br>
&gt;     &gt;<br>
&gt;     &gt;     *<br>
&gt;     &gt;       It should be possible to terminate dialogs in the “early” state,<br>
&gt;     &gt;       i.e., sending out BYE/CANCEL requests in order to terminate all<br>
&gt;     &gt;       branches appropriately.<br>
&gt;     &gt;           o<br>
&gt;     &gt;             ibc: IMHO it would be easier just to cancel the<br>
&gt;     transaction<br>
&gt;     &gt;             as when fr_inv_timer expires, this is, by sending a CANCEL<br>
&gt;     &gt;             to all the pending branches and a 408 to the UAC<br>
&gt;     (perhaps in<br>
&gt;     &gt;             this case a 480 would be more appropriate).<br>
&gt;     &gt;<br>
&gt;     &gt; The only way we could think of doing this was to send a fake reply via<br>
&gt;     &gt; the TM module. We have therefore exposed the fake_reply function from<br>
&gt;     &gt; the TM module and using that to terminate early dialogs. It works<br>
&gt;     in the<br>
&gt;     &gt; test scenarios we have performed, but the main drawback we can see<br>
&gt;     here<br>
&gt;     &gt; is that the dialog module needs to hold a pointer to the<br>
&gt;     transaction for<br>
&gt;     &gt; each dialog (not sure how bad this is as my experience with tm is not<br>
&gt;     &gt; expert yet ;) )<br>
&gt;     &gt;<br>
&gt;     &gt; So any thoughts/ideas. Is this the correct way to do it? Would it be<br>
&gt;     &gt; okay to expose a fake_reply function through TM API?<br>
&gt;<br>
&gt;     I cannot comment on how good or bad it is to expose the fake_reply<br>
&gt;     function.<br>
&gt;<br>
&gt;     Regarding pointing each dialog to its associated transaction at a given<br>
&gt;     time: This is already implemented in the current dialog(1) module. It<br>
&gt;     was needed for several reasons, one of them being to allow access to<br>
&gt;     dialog variables in responses. The way the link between dialogs and<br>
&gt;     transactions is done is by attaching a transaction pointer to the<br>
&gt;     TMCB_MAX callback which is fetched when required. Look at<br>
&gt;     store_dlg_in_tm() in dlg_handlers.c and get_dialog_from_tm() in<br>
&gt;     dlg_profile.c.<br>
&gt;<br>
&gt;     Yes, abusing TMCB_MAX to store additional data is kinda hackish. The<br>
&gt;     point here is that the dialog/transaction linkage is definitely needed,<br>
&gt;     so IMHO you may go ahead and re-establish it in dialog2. Finding a<br>
&gt;     cleaner implementation approach that doesn&#39;t involve TMCB_MAX is highly<br>
&gt;     appreciated though.<br>
&gt;<br>
&gt;<br>
&gt;     HTH,<br>
&gt;<br>
&gt;     --Timo<br>
</div></div></blockquote></div><br>