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