Two Persons calling eachother at the same time problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[inline]

On 1/24/08, Thomas Plotkowiak <plotti at gmx.net> wrote:
>
> I stumbled upon a simple problem and am looking for an elegant solution to
> this:
>
> I have two clients that want to call eachother exactly in the same moment.
> What happens of course is that they end up making each one call to the
> other and have two calls instead of one.
>
> what happens is:
> A calls B --> B  accepts
> B calls A --> A  accepts
>
> what I want instead is:
>
> A calls B --> B  accepts
> B calls A --> A  rejects since it figures out its already connected to B.
>
> My way of solving this problem is in the callback function
> on_incoming_call:
> 1. Get all calls so far by using  pjsua_call_get_count<http://pjsip.org/pjsip/docs/html/group__PJSUA__LIB__CALL.htm#g97b0aaeb8f1e6feb8d6794a105abbdc9>().
> For all calls - 1, cause the last one is the incoming one do:
> 2. Check if the corresponding  ci. remote_info<http://pjsip.org/pjsip/docs/html/structpjsua__call__info.htm#cc7af5223a21349f5a5a8023cdc39812>.ptr
> is different then the current incoming new_ci. remote_info<http://pjsip.org/pjsip/docs/html/structpjsua__call__info.htm#cc7af5223a21349f5a5a8023cdc39812>.ptr
> by matching those 2 strings
>     If they match forbid the call (with 403 message) since I am either
> already connected to this person,
>     or am currently connecting to this person
>     Else accept with 200 code
>
> Is there a more elegant way of doing this, since I dont think the
> stringmatching is a very good way of checking that fact.


A slightly more elegant way of comparing the info's would be to compare the
two URIs:
 - first parse the strings into URIs with pjsip_parse_uri()
 - compare the URIs with pjsip_uri_cmp(PJSIP_URI_IN_FROMTO_HDR, uri1, uri2)

cheers,
 -benny



Cheers
> Thomas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080124/5146a4a0/attachment.html 


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux