[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sr-dev
Subject:    Re: [sr-dev] ACC events missing to-tag when doing t_reply
From:       Julien Chavanton <jchavanton () gmail ! com>
Date:       2020-07-31 23:39:38
Message-ID: CAKmcL2kbg=vs8MWuriKMQek4G1qx4LOX3N930oEU6H2V_GkMuQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


haha, found the mistake  that was so disturbing ...
%*.s >> %.*s

Not my best day !

I did not know this would remain uncaught by the compiler

On Fri, Jul 31, 2020 at 4:17 PM Julien Chavanton <jchavanton@gmail.com>
wrote:

> I tried adding a watchpoint in GDB I do not seen when how the data is
> replaced by empty characters ...
> 
> On Fri, Jul 31, 2020 at 3:31 PM Julien Chavanton <jchavanton@gmail.com>
> wrote:
> 
> > Sorry, the example was wrong ....
> > 
> > code :
> > 
> > void get_rpl_totag(struct cell *t, struct sip_msg *reply, str *totag) {
> > if (reply==FAKED_REPLY || !reply || !reply->to) {
> > tmb.t_get_reply_totag(t->uas.request, totag);
> > }
> > if (totag && totag->s) {
> > LM_ERR("reply_totag ok [%p][%d][%*.s]\n", totag->s,
> > totag->len, totag->len, totag->s);
> > }
> > }
> > ...
> > str ttag = STR_NULL;
> > get_rpl_totag(t, reply, &ttag);
> > LM_ERR(">>> ttag[%p][%d][%.*s]\n", ttag.s, ttag.len, ttag.len, ttag.s);
> > 
> > 
> > outputs :
> > 
> > 0(25920) ERROR: acc [acc_logic.c:97]: get_rpl_totag(): reply_totag ok
> > [0x7f0559c2a1e0][41][                                         ]
> > 0(25920) ERROR: acc [acc_logic.c:525]: on_missed(): >>>
> > ttag[0x7f0559c2a1e0][41][594d50c3218065a60bb91fd47a70fbc1-857d6855]
> > 
> > 
> > 
> > On Fri, Jul 31, 2020 at 3:26 PM Julien Chavanton <jchavanton@gmail.com>
> > wrote:
> > 
> > > I can not find the explanation on why the data memory is different once
> > > I return from the function.
> > > This is the same process and the same memory address.
> > > 
> > > code :
> > > 
> > > void get_rpl_totag(struct cell *t, struct sip_msg *reply, str *totag) {
> > > if (reply==FAKED_REPLY || !reply || !reply->to) {
> > > tmb.t_get_reply_totag(t->uas.request, totag);
> > > }
> > > if (totag && totag->s) {
> > > LM_ERR("reply_totag ok [%p][%d][%*.s]\n", totag->s,
> > > totag->len, totag->len, totag->s);
> > > }
> > > }
> > > 
> > > str ttag = STR_NULL;
> > > get_rpl_totag(t, reply, &ttag);
> > > LM_ERR(">>> to-tag[%p][%d][%.*s]\n", acc_env.to_tag.s,
> > > acc_env.to_tag.len, acc_env.to_tag.len, acc_env.to_tag.s);
> > > 
> > > 
> > > outputs :
> > > 
> > > 0(25216) ERROR: acc [acc_logic.c:97]: get_rpl_totag(): reply_totag ok
> > > [0x7fa6a79d81e0][41][                                         ]
> > > 0(25216) ERROR: acc [acc_logic.c:525]: on_missed(): >>>>>>>>>>>
> > > to-tag[0x7fa6a79d81e0][41][594d50c3218065a60bb91fd47a70fbc1-857d6855]
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > On Fri, Jul 31, 2020 at 8:33 AM Julien Chavanton <jchavanton@gmail.com>
> > > wrote:
> > > 
> > > > Seems to work, I will complete the modifications and make an MR ...
> > > > 
> > > > On Fri, Jul 31, 2020 at 12:30 AM Julien Chavanton <jchavanton@gmail.com>
> > > > wrote:
> > > > 
> > > > > I can see TM API is exposing
> > > > > 
> > > > > tmb.t_get_reply_totag(msg, &to_tag);
> > > > > 
> > > > > looking at what can be done from acc_logic.c
> > > > > 
> > > > > on_missed
> > > > > 
> > > > > /* set env variables */
> > > > > env_set_to( get_rpl_to(t,reply) );
> > > > > env_set_code_status( code, reply);
> > > > > ...
> > > > > 
> > > > > On Thu, Jul 30, 2020 at 11:51 PM Julien Chavanton <
> > > > > jchavanton@gmail.com> wrote:
> > > > > 
> > > > > > Hi, considering this example :
> > > > > > 
> > > > > > 
> > > > > > modparam("acc_json", "acc_missed_flag", 6)
> > > > > > 
> > > > > > failure_route[test] {
> > > > > > setflag(6); // MISSED_ACC, the failure will be recorded by ACC
> > > > > > t_flush_flags(); // This will set the flags in the newly created \
> > > > > > transaction t_reply("500", "Service Unavailable");
> > > > > > }
> > > > > > 
> > > > > > This does generate an ACC event, however the to-tag is not populated, my \
> > > > > > guess this is because the TM callback is done before the to-tag is \
> > > > > > generated. 
> > > > > > I wonder if there is a way to populate the to-tag immediately ?
> > > > > > 
> > > > > > I will dig it further, but maybe there is a trick I am missing
> > > > > > 
> > > > > > 


[Attachment #5 (text/html)]

<div dir="ltr"><div><div><div>haha, found the mistake   that was so disturbing ... \
<br></div><span class="gmail-im"><span style="font-family:monospace">%*.s &gt;&gt; \
<span class="gmail-im"><span \
style="font-family:monospace">%.*s<br><br></span></span></span></span></div><span \
class="gmail-im"><span style="font-family:monospace"><span class="gmail-im"><span \
style="font-family:monospace">Not my best day \
!<br><br></span></span></span></span></div><span class="gmail-im"><span \
style="font-family:monospace"><span class="gmail-im"><span \
style="font-family:monospace">I did not know this would remain uncaught by the \
compiler   <br></span></span></span></span></div><br><div class="gmail_quote"><div \
dir="ltr" class="gmail_attr">On Fri, Jul 31, 2020 at 4:17 PM Julien Chavanton &lt;<a \
href="mailto:jchavanton@gmail.com">jchavanton@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I tried \
adding a watchpoint in GDB I do not seen when how the data is replaced by empty \
characters ...<br></div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">On Fri, Jul 31, 2020 at 3:31 PM Julien Chavanton &lt;<a \
href="mailto:jchavanton@gmail.com" target="_blank">jchavanton@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div \
dir="ltr"><div>Sorry, the example was wrong ....<br><br></div><span \
style="font-family:monospace"><span style="color:rgb(11,83,148)"><span \
style="font-family:verdana,sans-serif">code :</span></span><br></span><div><span \
style="font-family:monospace"><br></span></div><div><span \
style="font-family:monospace">void get_rpl_totag(struct cell *t, struct sip_msg \
*reply, str *totag) {<br>            if (reply==FAKED_REPLY || !reply || \
!reply-&gt;to) {<br>                        \
tmb.t_get_reply_totag(t-&gt;uas.</span><span style="font-family:monospace">request, \
totag);<br>            }<br>            if (totag &amp;&amp; totag-&gt;s) {<br>       \
LM_ERR(&quot;reply_totag ok [%p][%d][%*.s]\n&quot;, totag-&gt;s, totag-&gt;len, \
totag-&gt;len, totag-&gt;s);<br>            }<br>}<br></span></div><div><span \
style="font-family:monospace">...<br></span></div><div><span \
style="font-family:monospace">str ttag = STR_NULL;<br>get_rpl_totag(t, reply, \
&amp;ttag);<br>LM_ERR(&quot;&gt;&gt;&gt; ttag[%p][%d][%.*s]\n&quot;, ttag.s, \
ttag.len, ttag.len, ttag.s);<br></span></div><div><span \
style="font-family:monospace"><br></span></div><div><span \
style="font-family:monospace"><br></span></div><div><div><span \
style="color:rgb(11,83,148)"><span style="font-family:verdana,sans-serif">outputs \
:</span></span></div><span style="font-family:monospace"></span></div><div><span \
style="font-family:monospace"><br></span></div><div><span \
style="font-family:monospace">0(25920) ERROR: acc [acc_logic.c:97]: get_rpl_totag(): \
reply_totag ok [0x7f0559c2a1e0][41][                                                  \
]<br>0(25920) ERROR: acc [acc_logic.c:525]: on_missed(): &gt;&gt;&gt; \
ttag[0x7f0559c2a1e0][41][594d50c3218065a60bb91fd47a70fbc1-857d6855]</span><br><br><br></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 31, 2020 at 3:26 PM \
Julien Chavanton &lt;<a href="mailto:jchavanton@gmail.com" \
target="_blank">jchavanton@gmail.com</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><span \
style="font-family:verdana,sans-serif">I can not find the explanation on why the data \
memory is different once I return from the function.</span></div><div><span \
style="font-family:monospace"><span style="font-family:verdana,sans-serif">This is \
the same process and the same memory address.</span><br></span></div><div><span \
style="color:rgb(11,83,148)"><span style="font-family:monospace">   \
</span></span></div><div><span style="color:rgb(11,83,148)"><span \
style="font-family:monospace"></span></span></div><div><div><div><span \
style="font-family:monospace"><span style="color:rgb(11,83,148)"><span \
style="font-family:verdana,sans-serif">code \
:</span></span><br></span></div><div><br><span \
style="font-family:monospace"></span></div><div><span \
style="font-family:monospace">void get_rpl_totag(struct cell *t, struct sip_msg \
*reply, str *totag) {<br>            if (reply==FAKED_REPLY || !reply || \
!reply-&gt;to) {<br>                        tmb.t_get_reply_totag(t-&gt;uas.request, \
totag);<br>            }<br>            if (totag &amp;&amp; totag-&gt;s) {<br>       \
LM_ERR(&quot;reply_totag ok [%p][%d][%*.s]\n&quot;, totag-&gt;s, totag-&gt;len, \
totag-&gt;len, totag-&gt;s);<br>            }<br>}<br><br>str ttag = \
STR_NULL;<br>get_rpl_totag(t, reply, &amp;ttag);<br>LM_ERR(&quot;&gt;&gt;&gt; \
to-tag[%p][%d][%.*s]\n&quot;, acc_env.to_tag.s, acc_env.to_tag.len, \
acc_env.to_tag.len, acc_env.to_tag.s);</span><br><br><div><br></div><div><span \
style="color:rgb(11,83,148)"><span style="font-family:verdana,sans-serif">outputs \
:</span></span></div><div><br></div><div><span style="font-family:monospace">  \
0(25216) ERROR: acc [acc_logic.c:97]: get_rpl_totag(): reply_totag ok \
[0x7fa6a79d81e0][41][                                                             \
]<br>  0(25216) ERROR: acc [acc_logic.c:525]: on_missed(): \
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; \
to-tag[0x7fa6a79d81e0][41][594d50c3218065a60bb91fd47a70fbc1-857d6855]<br></span></div> \
<div><br></div><div><br></div><div><br></div><br><br></div></div></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 31, 2020 at 8:33 AM \
Julien Chavanton &lt;<a href="mailto:jchavanton@gmail.com" \
target="_blank">jchavanton@gmail.com</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr">Seems to work, I will complete the \
modifications and make an MR ...<br></div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">On Fri, Jul 31, 2020 at 12:30 AM Julien Chavanton &lt;<a \
href="mailto:jchavanton@gmail.com" target="_blank">jchavanton@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I \
can see TM API is exposing <br><br>tmb.t_get_reply_totag(msg, \
&amp;to_tag);<br><br></div><div>looking at what can be done from \
acc_logic.c<br></div><div><br></div>on_missed<br><br>/* set env variables \
*/<br>env_set_to( get_rpl_to(t,reply) );<br>env_set_code_status( code, \
reply);<br>...<br></div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">On Thu, Jul 30, 2020 at 11:51 PM Julien Chavanton &lt;<a \
href="mailto:jchavanton@gmail.com" target="_blank">jchavanton@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div \
dir="ltr"><div><pre style="box-sizing:inherit;margin:4px \
0px;padding:8px;font-size:12px;line-height:1.50001;font-variant-ligatures:none;white-s \
pace:pre-wrap;word-break:normal;border-radius:4px;color:rgb(29,28,29);font-style:norma \
l;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text- \
indent:0px;text-transform:none;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><span \
style="font-family:verdana,sans-serif">Hi, considering this example \
:<br></span><br><br>modparam(&quot;acc_json&quot;, &quot;acc_missed_flag&quot;, \
6)<br><br>failure_route[test] {<br>    setflag(6); // MISSED_ACC, the failure will be \
recorded by ACC<br>    t_flush_flags(); // This will set the flags in the newly \
created transaction<br>    t_reply(&quot;500&quot;, &quot;Service \
Unavailable&quot;);<br>}<br><br><span style="font-family:verdana,sans-serif">This \
does generate an ACC event, however the to-tag is not populated, my guess this is \
because the TM callback is done before the to-tag is generated.<br></span></pre><pre \
style="box-sizing:inherit;margin:4px \
0px;padding:8px;font-size:12px;line-height:1.50001;font-variant-ligatures:none;white-s \
pace:pre-wrap;word-break:normal;border-radius:4px;color:rgb(29,28,29);font-style:norma \
l;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text- \
indent:0px;text-transform:none;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><span \
style="font-family:verdana,sans-serif">I wonder if there is a way to populate the \
to-tag immediately ?<br><br></span></pre><pre style="box-sizing:inherit;margin:4px \
0px;padding:8px;font-size:12px;line-height:1.50001;font-variant-ligatures:none;white-space:pre-wrap;word-break:normal;font-family:Monaco,Menlo,Consolas,&quot;Courier \
New&quot;,monospace;border-radius:4px;color:rgb(29,28,29);font-style:normal;font-varia \
nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;t \
ext-transform:none;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><span \
style="font-family:verdana,sans-serif">I will dig it further, but maybe there is a \
trick I am missing </span><br></pre></div></div> </blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>



_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic