Hi Vlasis, > 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. As end user, h323id/e164 will have priority than ip, to make a call. As wholesale provider/your case, IP address have priority than h323id/164.
In corporating your changes, will break the end user case. So we will have to add your changes, without breaking first case. Other reason, comparing ip first, someone might be using two phones on same ip, than we don't whom we are referring to. > 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. What I understood, You want to make a call on to IP address, instead of h323id/e164 alias. You can set the IP address for h323id/e164 number in config file. How the call is originated in your case. Are you making call or responding to incoming call? Another solution: As per standard, you can use peer->url to compare it. Adding 'url' comparing in find_peer() will be alright. And defining 'url' in config file, instead of h323id/e164. Let me know if I understood wrong. > 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? yes. Regards, Avin Patel Objective Systems, Inc. > > > -----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&kid=110944&bid=241720&dat=121642 > _______________________________________________ > ooh323c-devel mailing list > ooh323c-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ooh323c-devel > > > ------------------------------------------------------- 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