Hi Avin, The changes that I sent were working for all the tests that I made. The reason I changed the find_peer() function was that it seemed more logical to search all the peers first based on the IP address, then based on the h323id and last based on e164. Usually, in wholesale scenarios, the incoming calls are authorized based on the IP address, which cannot be spoofed like the h323id or the e164.
This is why I chose to check the IP first, then the h323id and last the e164. I tried to avoid creating a separate function like find_ip_peer() because whenever we would need to find out which peer is sending the incoming call we would probably need to call 2 functions, first find_ip_peer() and if it fails then call find_peer(). However, if you have any suggestions as to how we could tackle the problem in a different manner, I'll be happy to go to the direction that you recommend. As for the friends, this term was taken from the ooh323.conf file... I assumed that it had the same meaning as the "friends" term in the sip.conf file, ie, a "friend" is both a user and a peer, am I right? Now, concerning the absence of early audio that we talked in a previous email: I noticed that the code of ooh323 is written in a manner which would negotiate the audio codecs and open the RTP channels during the call negotiation. I tracked the ooh323 code, and everything shows that there should be early audio for providing ringback or announcements before the call is answered, but this is not the case. The RTP channels open only when the call is answered. Do you think that I should start looking at the stack code to find out the solution, as there does not seem to be anything out-of-place with the ooh323 driver code? Best regards, Vlasis Hatzistavrou Technical Director & CEO Kinetix Tele.com Hellas Ltd. Monastiriou 9 & Enotikon 546 27 Thessaloniki Greece Tel.: +302310556134 Fax: +302310556134 (ext. 0) GSM: +306977835653 e-mail: [EMAIL PROTECTED] http://www.kinetix.gr -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Avin Patel Sent: Thursday, February 23, 2006 2:44 AM To: ooh323c-devel@lists.sourceforge.net Subject: RE: [ooh323c-devel] Fix for IP recognition for matching contexts from calls originating from friends Hi Vlasis, > struct ooh323_peer *find_peer(const char * name) > { .... > while(peer) > { > if(!strcasecmp(peer->name, name)) > break; > if(peer->ip && !strcasecmp(peer->ip, name)) > break; > if(peer->h323id && !strcasecmp(peer->h323id, name)) > break; > if(peer->e164 && !strcasecmp(peer->e164, name)) > break; > peer = peer->next; > } ... I guess this changes can't be incorporated in find_peer(), but need a seperate function to compare peer based on ip address for ooh323_onReceivedSetup() function. like find_ip_peer() > if(p->callerid_name) > { > p->username = strdup(p->callerid_name); > user = find_user(p->username); > if(user) > { > ast_mutex_lock(&user->lock); > strncpy(p->context, user->context, sizeof(p->context)-1); > strncpy(p->accountcode, user->accountcode, > sizeof(p->accountcode)-1); > p->amaflags = user->amaflags; > p->capability = user->capability; > memcpy(&p->prefs, &user->prefs, sizeof(struct ast_codec_pref)); > p->dtmfmode = user->dtmfmode; > /* Since, call is coming from a pbx user, no need to use gk */ > OO_SETFLAG(p->flags, H323_DISABLEGK); > OO_SETFLAG(call->flags, OO_M_DISABLEGK); > ast_mutex_unlock(&user->lock); > } > } > > > Add: > > peer = find_peer(strdup(call->remoteIP)); > if(peer) > { > user = find_user(peer->name); > if(user) > { > ast_mutex_lock(&user->lock); > strncpy(p->context, user->context, sizeof(p->context)-1); > strncpy(p->accountcode, user->accountcode, > sizeof(p->accountcode)-1); > p->amaflags = user->amaflags; > p->capability = user->capability; > memcpy(&p->prefs, &user->prefs, sizeof(struct > ast_codec_pref)); > p->dtmfmode = user->dtmfmode; > /* Since, call is coming from a pbx user, no need to use > gk */ > OO_SETFLAG(p->flags, H323_DISABLEGK); > OO_SETFLAG(call->flags, OO_M_DISABLEGK); > ast_mutex_unlock(&user->lock); > } > > } I guess should be: if(p->callerid_name) { ...... } else { peer = find_ip_peer(strdup(call->remoteIP)); if(peer) { user = find_user(peer->name); if(user) { ast_mutex_lock(&user->lock); strncpy(p->context, user->context, sizeof(p->context)-1); strncpy(p->accountcode, user->accountcode, sizeof(p->accountcode)-1); p->amaflags = user->amaflags; p->capability = user->capability; memcpy(&p->prefs, &user->prefs, sizeof(struct ast_codec_pref)); p->dtmfmode = user->dtmfmode; /* Since, call is coming from a pbx user, no need to use gk */ OO_SETFLAG(p->flags, H323_DISABLEGK); OO_SETFLAG(call->flags, OO_M_DISABLEGK); ast_mutex_unlock(&user->lock); } } } > A few weeks ago I tried to find a way to match incoming calls from > "friends" to their contexts, based on the IP address of the "friend". What you mean by "friends"? If a calls is coming from particular IP address, than what you want to do? Regards, Avin Patel Objective Systems, Inc. ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 _______________________________________________ ooh323c-devel mailing list ooh323c-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ooh323c-devel