You are right patch does not work for Async commands. I will try to fix it per your guidelines. Once again many thanks for your insight into the matter.
Thank you. On Sat, Mar 29, 2014 at 3:53 AM, Muhammad Shahzad <shaherya...@gmail.com>wrote: > humm, > > When datagram server is initialized in method "mi_init_datagram_server", > it set tx_sock equal to rx_sock, instead of creating a new reply socket. So > that when an async command is received in method "mi_datagram_server" with > tx_sock reference, i pass it to "build_async_handler" method which is then > stored to a newly added parameter to "my_address_socket" structure (see the > last 5 lines of this method). This same structure is passed and used to > send reply in "datagram_close_async" method, so i just used the existing > socket reference stored in structure to send the reply, instead of creating > new one. > > So basically original socket reference is preserved for reply, instead of > creating new. Shouldn't this work for async process or i am missing > something here? > > Thank you. > > > > > On Fri, Mar 28, 2014 at 11:28 PM, Daniel-Constantin Mierla < > mico...@gmail.com> wrote: > >> Have you tested with async mi commands? The function >> build_async_handler() is cloning the information in shared memory, >> expecting that the response to the mi command to be done from another >> process. In that case, the socket is no longer valid, because it was >> created only in the mi process. >> >> I haven't analyzed deeply, but it is very likely to be what I said above. >> >> Options coming in my mind: >> >> - for async case keep the old way of creating a new socket. This can be >> propagated by setting field tx_sock=0 >> - try to bind to same socket in async handler, provided the initial >> socket is created with resuse addr/port >> >> Cheers, >> Daniel >> >> >> On 28/03/14 21:49, Muhammad Shahzad wrote: >> >> Please find attached updated patch as requested. >> >> >> On Fri, Mar 28, 2014 at 8:49 PM, Daniel-Constantin Mierla < >> mico...@gmail.com> wrote: >> >>> Thanks for the patch. Can you resend it without commented code? Just >>> remove the lines that are no longer used, to have clean code. >>> >>> Cheers, >>> Daniel >>> >>> >>> On 28/03/14 01:29, Muhammad Shahzad wrote: >>> >>>> Hi, >>>> >>>> After wasting most of the day trying to make mi_datagram over UDP >>>> socket work. I eventually realize that it does asymmetric UDP >>>> communication, which creates a lot of trouble for writing a useful MI >>>> script using PERL or Python etc. >>>> >>>> Anyhow, i go through the module code and was able to write a patch for >>>> symmetric UDP communication using mi_datagram. >>>> >>>> I have tested the patch using both Kamailio 4.1 and trunk branches and >>>> it seems to compile and run flawlessly. >>>> >>>> I am attaching here with this patch for Kamailio community. It would be >>>> great if Kamailio developers would review and commit this patch to source >>>> trunk. >>>> >>>> Thank you. >>>> >>>> >>>> >>> -- >>> Daniel-Constantin Mierla - http://www.asipto.com >>> http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda >>> Kamailio World Conference - April 2-4, 2014, Berlin, Germany >>> http://www.kamailioworld.com >>> >>> >> >> -- >> Daniel-Constantin Mierla - >> http://www.asipto.comhttp://twitter.com/#!/miconda - >> http://www.linkedin.com/in/miconda >> Kamailio World Conference - April 2-4, 2014, Berlin, >> Germanyhttp://www.kamailioworld.com >> >> >
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users