I&#39;m using an older version in production of openser with the LCR module and I&#39;ve tried using $rd to account where the call went. I get a lot of problems doing this because of things like RE-INVITES and such. It&#39;s been a real headache. It doesn&#39;t seem to be&nbsp;consistently&nbsp;accurate. I can&#39;t reproduce the problem, but if I ramp up 10,000 calls, it&#39;ll happen.<div>
<br></div><div>One particular problem happens like this. And I know this isn&#39;t DR, but I&#39;d expect it to have a similar problem. First of all, understand that I&#39;m writing my own CDR records with avp_db_query and not with ACC since I want a unified single record per call.</div>
<div><br></div><div>Ok, an old bug in Asterisk causes it to set the T1 SIP Timer to the length of time of an OPTIONS reply. This is really stupid. So Asterisk expects my OpenSER proxy to reply in 1ms to an INVITE. It just doesn&#39;t happen. So sometimes I get retransmissions. Each INVITE that is&nbsp;received&nbsp;performs a load_gws(). Which, because of the RAND in there, sometimes loads GW1, and sometimes loads GW2. &nbsp;Because they both have the same callid, sometimes the original INVITE $rd overwrites the retransmitted $rd and thus the wrong gateway IP is recorded in the call record (avp_db_query).&nbsp;</div>
<div><br></div><div>Now I&#39;ve tried to resolve this by:&nbsp;</div><div>1. Inserting a 1 sec sleep for OPTIONS replies in openser</div><div>2. Manually replying with a 1XX reply to avoid retransmissions. I&#39;m not sure why this was necessary. I noticed that if I don&#39;t manually do this, OpenSER&#39;s 100 reply comes at about 250ms after the request. If I manually do it, I get it at about 25ms.</div>
<div><br></div><div>I&#39;m sure I&#39;m probably doing something wrong here.. in maybe a number of places. I feel like I probably need a t_newtrans() somewhere, but I don&#39;t really know how to use it properly. :/</div>
<div><br></div><div>Besides all of that, it&#39;s not really the GW IP that I want to be attached to the call record, but it&#39;s the GATEWAY ID that I want. And I suspect is more useful overall. The reason is that, for example, I send calls to a SIP/PSTN gateway and prefix the calls with 001-004 to indicate PRI #1-#4. The IP is the same for all 4 trunks. So sometimes, the $rd doesn&#39;t really tell you what &quot;trunk&quot; it&#39;s going to go out on. Which on the CDR record is really what I want.&nbsp;</div>
<div><br></div><div>I feel like both LCR and DR need to write an AVP to indicate the GATEWAY ID last set to $rd. Thoughts?</div><div><br></div><div>-Brett</div><div><br></div><div><br><div class="gmail_quote">On Thu, Jan 22, 2009 at 11:38 AM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Brett,<br>
<br>
but you have the GW IP (that was used) already in the RURI...or ?<br>
<br>
Regards,<br>
Bogdan<br>
<br>
Brett Nemeroff wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="Ih2E3d">
Is there not a way to store in an AVP the gateway that was used in the call? I have this need as well..<br>
-Brett<br>
<br>
<br></div><div><div></div><div class="Wj3C7c">
On Thu, Jan 22, 2009 at 9:44 AM, ibrahim tunali &lt;<a href="mailto:ibrahimtunali@gmail.com" target="_blank">ibrahimtunali@gmail.com</a> &lt;mailto:<a href="mailto:ibrahimtunali@gmail.com" target="_blank">ibrahimtunali@gmail.com</a>&gt;&gt; wrote:<br>

<br>
 &nbsp; &nbsp;Hi Bogdan,<br>
<br>
 &nbsp; &nbsp;I have already set attr avp like you sent. The problem occured when<br>
 &nbsp; &nbsp;fill the attr field. If I leave blank attr field in DB it starts but<br>
 &nbsp; &nbsp;when i set something like &quot;gw1&quot; it crashed.<br>
<br>
 &nbsp; &nbsp;My db row;<br>
<br>
 &nbsp; &nbsp;+------+------+-------------------+-------+------------+-------+-------------+<br>
 &nbsp; &nbsp;| gwid | type | address &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | strip | pri_prefix | attrs |<br>
 &nbsp; &nbsp;description |<br>
 &nbsp; &nbsp;+------+------+-------------------+-------+------------+-------+-------------+<br>
 &nbsp; &nbsp;| &nbsp; &nbsp;1 | &nbsp; &nbsp;1 | XX.XX.XXX.XX:XXXX | &nbsp; &nbsp; 0 | NULL &nbsp; &nbsp; &nbsp; | gw1 &nbsp; |<br>
 &nbsp; &nbsp;main GW &nbsp; &nbsp; |<br>
 &nbsp; &nbsp;+------+------+-------------------+-------+------------+-------+-------------+<br>
<br>
 &nbsp; &nbsp;Crash dump;<br>
<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns: 6<br>
 &nbsp; &nbsp;columns returned from the query<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:core:db_allocate_columns: allocate 48<br>
 &nbsp; &nbsp;bytes for result names at 0x76a570<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:core:db_allocate_columns: allocate 24<br>
 &nbsp; &nbsp;bytes for result types at 0x76a5b0<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns: allocate<br>
 &nbsp; &nbsp;16 bytes for RES_NAMES[0] at 0x76a5d8<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns:<br>
 &nbsp; &nbsp;RES_NAMES(0x76a5d8)[0]=[gwid]<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns: use<br>
 &nbsp; &nbsp;DB_INT result type<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns: allocate<br>
 &nbsp; &nbsp;16 bytes for RES_NAMES[1] at 0x76a5f8<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns:<br>
 &nbsp; &nbsp;RES_NAMES(0x76a5f8)[1]=[address]<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns: use<br>
 &nbsp; &nbsp;DB_STRING result type<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns: allocate<br>
 &nbsp; &nbsp;16 bytes for RES_NAMES[2] at 0x76a618<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns:<br>
 &nbsp; &nbsp;RES_NAMES(0x76a618)[2]=[strip]<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns: use<br>
 &nbsp; &nbsp;DB_INT result type<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns: allocate<br>
 &nbsp; &nbsp;16 bytes for RES_NAMES[3] at 0x76a638<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns:<br>
 &nbsp; &nbsp;RES_NAMES(0x76a638)[3]=[pri_prefix]<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns: use<br>
 &nbsp; &nbsp;DB_STRING result type<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns: allocate<br>
 &nbsp; &nbsp;16 bytes for RES_NAMES[4] at 0x76a658<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns:<br>
 &nbsp; &nbsp;RES_NAMES(0x76a658)[4]=[type]<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns: use<br>
 &nbsp; &nbsp;DB_INT result type<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns: allocate<br>
 &nbsp; &nbsp;16 bytes for RES_NAMES[5] at 0x76a678<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns:<br>
 &nbsp; &nbsp;RES_NAMES(0x76a678)[5]=[attrs]<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_get_columns: use<br>
 &nbsp; &nbsp;DB_STRING result type<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_fetch_result:<br>
 &nbsp; &nbsp;converting row 0 of 1 count 1<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_convert_row: allocate<br>
 &nbsp; &nbsp;192 bytes for row values at 0x76a6b8<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_str2val:<br>
 &nbsp; &nbsp;converting INT [1]<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_str2val: converting<br>
 &nbsp; &nbsp;STRING [69.XX.XXX.55:XXXX]<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_str2val:<br>
 &nbsp; &nbsp;converting INT [0]<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_str2val:<br>
 &nbsp; &nbsp;converting INT [1]<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:db_mysql:db_mysql_str2val: converting<br>
 &nbsp; &nbsp;STRING [gw1]<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:drouting:dr_load_routing_info: 1<br>
 &nbsp; &nbsp;records found in dr_gateways<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10261]: DBG:drouting:add_dst: new gw ip addr<br>
 &nbsp; &nbsp;[69.XX.XXX.55:XXXX]<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10249]: INFO:core:handle_sigs: child process 10261<br>
 &nbsp; &nbsp;exited by a signal 11<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10267]: DBG:core:init_mod_child: type=CHILD,<br>
 &nbsp; &nbsp;rank=4, module=registrar<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10249]: INFO:core:handle_sigs: core was not<br>
 &nbsp; &nbsp;generated<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10267]: DBG:core:init_mod_child: type=CHILD,<br>
 &nbsp; &nbsp;rank=4, module=group<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10249]: INFO:core:handle_sigs: terminating due<br>
 &nbsp; &nbsp;to SIGCHLD<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10267]: INFO:core:sig_usr: signal 15 received<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10267]: Memory status (pkg):<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10273]: INFO:core:sig_usr: signal 15 received<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10273]: Memory status (pkg):<br>
 &nbsp; &nbsp;/usr/sbin/opensips[10267]: fm_status (0x72bbe0):<br>
<br>
 &nbsp; &nbsp;Regards,<br>
<br>
 &nbsp; &nbsp;Ibrahim TUNALI<br>
<br>
<br>
 &nbsp; &nbsp;On Thu, Jan 22, 2009 at 17:20, Bogdan-Andrei Iancu<br></div></div><div class="Ih2E3d">
 &nbsp; &nbsp;&lt;<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a> &lt;mailto:<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a>&gt;&gt; wrote:<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt; Hi Ibrahim,<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt; have you set the attr avp? Something like:<br>
 &nbsp; &nbsp;&gt; &nbsp; modparam(&quot;drouting&quot;, &quot;attrs_avp&quot;, &#39;$avp(s:dr_attrs)&#39;)<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt; Then after do_routing() or use_next_gw(), do :<br>
 &nbsp; &nbsp;&gt; &nbsp;xlog(&quot;-----gw attr is $avp(s:dr_attrs)\n&quot;);<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt; the value of the attr is whatever you want - the module does not<br>
 &nbsp; &nbsp;interpret it - it is just reading it from DB and pass it to the<br>
 &nbsp; &nbsp;AVP when you use the GW. It is your decision what to put there and<br>
 &nbsp; &nbsp;how to use the value.<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt; Regards,<br>
 &nbsp; &nbsp;&gt; Bogdan<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt; ibrahim tunali wrote:<br>
 &nbsp; &nbsp;&gt;&gt;<br>
 &nbsp; &nbsp;&gt;&gt; Hello,<br>
 &nbsp; &nbsp;&gt;&gt;<br>
 &nbsp; &nbsp;&gt;&gt; I&#39;m playing with the new module drouting on svn trunk and i need to<br>
 &nbsp; &nbsp;&gt;&gt; get &quot;which gateway is used on last request&quot;. I might be able to<br>
 &nbsp; &nbsp;get it<br>
 &nbsp; &nbsp;&gt;&gt; with &quot;attrs_avp&quot; and &quot;attrs&quot; field on dr_gateways table, i guess. I<br>
 &nbsp; &nbsp;&gt;&gt; try some values to attrs but opensips crashed.<br>
 &nbsp; &nbsp;&gt;&gt;<br>
 &nbsp; &nbsp;&gt;&gt; Could you give an example to use attrs_avp and what is the value<br>
 &nbsp; &nbsp;&gt;&gt; format of &quot;attrs&quot; fields.<br>
 &nbsp; &nbsp;&gt;&gt;<br>
 &nbsp; &nbsp;&gt;&gt; Regards,<br>
 &nbsp; &nbsp;&gt;&gt;<br>
 &nbsp; &nbsp;&gt;&gt; Ibrahim TUNALI<br>
 &nbsp; &nbsp;&gt;&gt;<br>
 &nbsp; &nbsp;&gt;&gt; _______________________________________________<br>
 &nbsp; &nbsp;&gt;&gt; Users mailing list<br></div>
 &nbsp; &nbsp;&gt;&gt; <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> &lt;mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>&gt;<div class="Ih2E3d">
<br>
 &nbsp; &nbsp;&gt;&gt; <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
 &nbsp; &nbsp;&gt;&gt;<br>
 &nbsp; &nbsp;&gt;&gt;<br>
 &nbsp; &nbsp;&gt;<br>
<br>
 &nbsp; &nbsp;_______________________________________________<br>
 &nbsp; &nbsp;Users mailing list<br></div>
 &nbsp; &nbsp;<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> &lt;mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>&gt;<div class="Ih2E3d"><br>
 &nbsp; &nbsp;<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br>
<br>
</div></blockquote>
<br>
<br>
</blockquote></div><br></div>