mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-13 15:50:59 +00:00
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:
parent
e4aae70c44
commit
006e0f8d14
@ -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)
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -38,57 +38,59 @@ extern "C" {
|
||||
|
||||
#include <switch.h>
|
||||
|
||||
struct switch_caller_step {
|
||||
char *step_name;
|
||||
struct switch_caller_step *next_step;
|
||||
};
|
||||
struct switch_caller_step {
|
||||
char *step_name;
|
||||
struct switch_caller_step *next_step;
|
||||
};
|
||||
|
||||
struct switch_caller_profile {
|
||||
char *dialplan;
|
||||
char *caller_id_name;
|
||||
char *caller_id_number;
|
||||
char *ani;
|
||||
char *ani2;
|
||||
char *destination_number;
|
||||
struct switch_caller_step *steps;
|
||||
};
|
||||
struct switch_caller_profile {
|
||||
char *dialplan;
|
||||
char *caller_id_name;
|
||||
char *caller_id_number;
|
||||
char *network_addr;
|
||||
char *ani;
|
||||
char *ani2;
|
||||
char *destination_number;
|
||||
struct switch_caller_step *steps;
|
||||
};
|
||||
|
||||
struct switch_caller_application {
|
||||
char *application_name;
|
||||
char *application_data;
|
||||
switch_application_function application_function;
|
||||
struct switch_caller_application *next;
|
||||
};
|
||||
struct switch_caller_application {
|
||||
char *application_name;
|
||||
char *application_data;
|
||||
switch_application_function application_function;
|
||||
struct switch_caller_application *next;
|
||||
};
|
||||
|
||||
struct switch_caller_extension {
|
||||
char *extension_name;
|
||||
char *extension_number;
|
||||
struct switch_caller_application *current_application;
|
||||
struct switch_caller_application *last_application;
|
||||
struct switch_caller_application *applications;
|
||||
};
|
||||
struct switch_caller_extension {
|
||||
char *extension_name;
|
||||
char *extension_number;
|
||||
struct switch_caller_application *current_application;
|
||||
struct switch_caller_application *last_application;
|
||||
struct switch_caller_application *applications;
|
||||
};
|
||||
|
||||
SWITCH_DECLARE(switch_caller_extension *) switch_caller_extension_new(switch_core_session *session,
|
||||
char *extension_name,
|
||||
char *extension_number
|
||||
);
|
||||
SWITCH_DECLARE(switch_caller_extension *) switch_caller_extension_new(switch_core_session *session,
|
||||
char *extension_name,
|
||||
char *extension_number
|
||||
);
|
||||
|
||||
SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session *session,
|
||||
switch_caller_extension *caller_extension,
|
||||
char *application_name,
|
||||
char *extra_data);
|
||||
SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session *session,
|
||||
switch_caller_extension *caller_extension,
|
||||
char *application_name,
|
||||
char *extra_data);
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_new(switch_core_session *session,
|
||||
char *dialplan,
|
||||
char *caller_id_name,
|
||||
char *caller_id_number,
|
||||
char *ani,
|
||||
char *ani2,
|
||||
char *destination_number);
|
||||
SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_new(switch_core_session *session,
|
||||
char *dialplan,
|
||||
char *caller_id_name,
|
||||
char *caller_id_number,
|
||||
char *network_addr,
|
||||
char *ani,
|
||||
char *ani2,
|
||||
char *destination_number);
|
||||
|
||||
SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_clone(switch_core_session *session,
|
||||
switch_caller_profile *tocopy);
|
||||
SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_clone(switch_core_session *session,
|
||||
switch_caller_profile *tocopy);
|
||||
|
||||
|
||||
|
||||
|
@ -171,12 +171,13 @@ static void audio_bridge_function(switch_core_session *session, char *data)
|
||||
|
||||
caller_caller_profile = switch_channel_get_caller_profile(caller_channel);
|
||||
caller_profile = switch_caller_profile_new(session,
|
||||
caller_caller_profile->dialplan,
|
||||
caller_caller_profile->caller_id_name,
|
||||
caller_caller_profile->caller_id_number,
|
||||
NULL,
|
||||
NULL,
|
||||
chan_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);
|
||||
|
||||
|
||||
|
||||
|
@ -803,12 +803,13 @@ static switch_status exosip_create_call(eXosip_event_t *event)
|
||||
}
|
||||
|
||||
if ((tech_pvt->caller_profile = switch_caller_profile_new(session,
|
||||
globals.dialplan,
|
||||
event->request->from->displayname,
|
||||
event->request->from->url->username,
|
||||
event->request->from->url->username,
|
||||
NULL,
|
||||
event->request->req_uri->username))) {
|
||||
globals.dialplan,
|
||||
event->request->from->displayname,
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -872,12 +872,13 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ((tech_pvt->caller_profile = switch_caller_profile_new(session,
|
||||
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];
|
||||
|
@ -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);
|
||||
|
@ -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,14 +1073,16 @@ 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,
|
||||
NULL,
|
||||
NULL,
|
||||
exten))) {
|
||||
tech_pvt->profile->dialplan,
|
||||
cid_name,
|
||||
cid_num,
|
||||
ip,
|
||||
NULL,
|
||||
NULL,
|
||||
exten))) {
|
||||
char name[128];
|
||||
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
|
||||
snprintf(name, sizeof(name), "Woomera/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
|
||||
|
@ -32,12 +32,13 @@
|
||||
#include <switch_caller.h>
|
||||
|
||||
SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_new(switch_core_session *session,
|
||||
char *dialplan,
|
||||
char *caller_id_name,
|
||||
char *caller_id_number,
|
||||
char *ani,
|
||||
char *ani2,
|
||||
char *destination_number)
|
||||
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);
|
||||
@ -57,7 +59,7 @@ SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_new(switch_core_se
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_clone(switch_core_session *session,
|
||||
switch_caller_profile *tocopy)
|
||||
switch_caller_profile *tocopy)
|
||||
{
|
||||
switch_caller_profile *profile = NULL;
|
||||
if ((profile = switch_core_session_alloc(session, sizeof(switch_caller_profile)))) {
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -73,9 +76,9 @@ SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_clone(switch_core_
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_caller_extension *) switch_caller_extension_new(switch_core_session *session,
|
||||
char *extension_name,
|
||||
char *extension_number
|
||||
)
|
||||
char *extension_name,
|
||||
char *extension_number
|
||||
)
|
||||
{
|
||||
switch_caller_extension *caller_extension = NULL;
|
||||
|
||||
@ -90,9 +93,9 @@ SWITCH_DECLARE(switch_caller_extension *) switch_caller_extension_new(switch_cor
|
||||
|
||||
|
||||
SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session *session,
|
||||
switch_caller_extension *caller_extension,
|
||||
char *application_name,
|
||||
char *application_data)
|
||||
switch_caller_extension *caller_extension,
|
||||
char *application_name,
|
||||
char *application_data)
|
||||
{
|
||||
switch_caller_application *caller_application = NULL;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user