add network_addr to profile (had to add a func to get it for iax)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@175 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2005-12-20 16:01:18 +00:00
parent e4aae70c44
commit 006e0f8d14
10 changed files with 101 additions and 78 deletions

View File

@ -225,6 +225,8 @@ extern unsigned int iax_session_get_capability(struct iax_session *s);
extern char iax_pref_codec_add(struct iax_session *session, unsigned int format);
extern void iax_pref_codec_del(struct iax_session *session, unsigned int format);
extern int iax_pref_codec_get(struct iax_session *session, unsigned int *array, int len);
extern char *iax_get_peer_ip(struct iax_session *session);
extern char *iax_event_get_apparent_ip(struct iax_event *event);
#if defined(__cplusplus)
}

View File

@ -3145,6 +3145,16 @@ struct sockaddr_in iax_get_peer_addr(struct iax_session *session)
return session->peeraddr;
}
char *iax_get_peer_ip(struct iax_session *session)
{
return inet_ntoa(session->peeraddr.sin_addr);
}
char *iax_event_get_apparent_ip(struct iax_event *event)
{
return inet_ntoa(event->ies.apparent_addr->sin_addr);
}
void iax_session_destroy(struct iax_session **session)
{
destroy_session(*session);

View File

@ -139,7 +139,6 @@ extern int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen);
extern int iax_get_frames(void);
extern int iax_get_iframes(void);
extern int iax_get_oframes(void);
extern void iax_frame_wrap(struct iax_frame *fr, struct ast_frame *f);
extern struct iax_frame *iax_frame_new(int direction, int datalen);
extern void iax_frame_free(struct iax_frame *fr);

View File

@ -47,6 +47,7 @@ struct switch_caller_profile {
char *dialplan;
char *caller_id_name;
char *caller_id_number;
char *network_addr;
char *ani;
char *ani2;
char *destination_number;
@ -83,6 +84,7 @@ SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_new(switch_core_se
char *dialplan,
char *caller_id_name,
char *caller_id_number,
char *network_addr,
char *ani,
char *ani2,
char *destination_number);

View File

@ -174,6 +174,7 @@ static void audio_bridge_function(switch_core_session *session, char *data)
caller_caller_profile->dialplan,
caller_caller_profile->caller_id_name,
caller_caller_profile->caller_id_number,
caller_caller_profile->network_addr,
NULL,
NULL,
chan_data);

View File

@ -806,7 +806,8 @@ static switch_status exosip_create_call(eXosip_event_t *event)
globals.dialplan,
event->request->from->displayname,
event->request->from->url->username,
event->request->from->url->username,
event->request->req_uri->host,
NULL,
NULL,
event->request->req_uri->username))) {
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);

View File

@ -877,7 +877,8 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
globals.dialplan,
iaxevent->ies.calling_name,
iaxevent->ies.calling_number,
NULL,
iax_get_peer_ip(iaxevent->session),
iaxevent->ies.calling_ani,
NULL,
iaxevent->ies.called_number))) {
char name[128];

View File

@ -794,6 +794,7 @@ static switch_status place_call(char *dest, char *out, size_t outlen)
globals.cid_num,
NULL,
NULL,
NULL,
dest))) {
char name[128];
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);

View File

@ -1052,6 +1052,7 @@ static void *woomera_channel_thread_run(switch_thread *thread, void *obj)
char *exten;
char cid_name[512];
char *cid_num;
char *ip;
char *p;
switch_clear_flag(tech_pvt, TFLAG_PARSE_INCOMING);
switch_set_flag(tech_pvt, TFLAG_INCOMING);
@ -1072,11 +1073,13 @@ static void *woomera_channel_thread_run(switch_thread *thread, void *obj)
} else {
cid_num = woomera_message_header(&wmsg, "Remote-Number");
}
ip = woomera_message_header(&wmsg, "Remote-Address");
if ((tech_pvt->caller_profile = switch_caller_profile_new(session,
tech_pvt->profile->dialplan,
cid_name,
cid_num,
ip,
NULL,
NULL,
exten))) {

View File

@ -35,6 +35,7 @@ SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_new(switch_core_se
char *dialplan,
char *caller_id_name,
char *caller_id_number,
char *network_addr,
char *ani,
char *ani2,
char *destination_number)
@ -47,6 +48,7 @@ SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_new(switch_core_se
profile->dialplan = switch_core_session_strdup(session, dialplan);
profile->caller_id_name = switch_core_session_strdup(session, caller_id_name);
profile->caller_id_number = switch_core_session_strdup(session, caller_id_number);
profile->network_addr = switch_core_session_strdup(session, network_addr);
profile->ani = switch_core_session_strdup(session, ani);
profile->ani2 = switch_core_session_strdup(session, ani2);
profile->destination_number = switch_core_session_strdup(session, destination_number);
@ -66,6 +68,7 @@ SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_clone(switch_core_
profile->ani = switch_core_session_strdup(session, tocopy->ani);
profile->ani2 = switch_core_session_strdup(session, tocopy->ani2);
profile->caller_id_number = switch_core_session_strdup(session, tocopy->caller_id_number);
profile->network_addr = switch_core_session_strdup(session, tocopy->network_addr);
profile->destination_number = switch_core_session_strdup(session, tocopy->destination_number);
}