Skip to content

Commit

Permalink
ENGDESK-28859: Expose custom event basic data (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
baloeng authored Feb 21, 2024
1 parent 8fdc639 commit fe1ae15
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/include/switch_telnyx.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ typedef void (*switch_telnyx_set_current_trace_message_func)(const char*);
typedef switch_call_cause_t (*switch_telnyx_recompute_cause_code_func)(switch_channel_t*, int , switch_call_cause_t);
typedef switch_bool_t (*switch_telnyx_sip_cause_to_q850_func)(int, switch_call_cause_t*);
typedef switch_bool_t (*switch_telnyx_on_media_timeout_func)(switch_channel_t*, switch_rtp_t*);
typedef void (*switch_telnyx_channel_event_set_basic_data_func)(switch_channel_t*, switch_event_t*);

typedef struct switch_telnyx_event_dispatch_s {
switch_telnyx_hangup_cause_to_sip_func switch_telnyx_hangup_cause_to_sip;
Expand All @@ -43,6 +44,7 @@ typedef struct switch_telnyx_event_dispatch_s {
switch_telnyx_recompute_cause_code_func switch_telnyx_recompute_cause_code;
switch_telnyx_sip_cause_to_q850_func switch_telnyx_sip_cause_to_q850;
switch_telnyx_on_media_timeout_func switch_telnyx_on_media_timeout;
switch_telnyx_channel_event_set_basic_data_func switch_telnyx_channel_event_set_basic_data;
} switch_telnyx_event_dispatch_t;

SWITCH_DECLARE(void) switch_telnyx_init(switch_memory_pool_t *pool);
Expand Down Expand Up @@ -73,6 +75,7 @@ SWITCH_DECLARE(void) switch_telnyx_set_current_trace_message(const char* msg);
SWITCH_DECLARE(switch_call_cause_t) switch_telnyx_recompute_cause_code(switch_channel_t* channel, int status, switch_call_cause_t cause);
SWITCH_DECLARE(switch_bool_t) switch_telnyx_sip_cause_to_q850(int status, switch_call_cause_t* cause);
SWITCH_DECLARE(switch_bool_t) switch_telnyx_sip_on_media_timeout(switch_channel_t* channel, switch_rtp_t* rtp_session);
SWITCH_DECLARE(void) switch_telnyx_channel_event_set_basic_data(switch_channel_t *channel, switch_event_t *event);

SWITCH_END_EXTERN_C

Expand Down
1 change: 1 addition & 0 deletions src/switch_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2762,6 +2762,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_basic_data(switch_channel_t *chann
switch_caller_profile_event_set_data(originatee_caller_profile, "Other-Leg", event);
}

switch_telnyx_channel_event_set_basic_data(channel, event);

switch_mutex_unlock(channel->profile_mutex);
}
Expand Down
7 changes: 7 additions & 0 deletions src/switch_telnyx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,11 @@ switch_bool_t switch_telnyx_sip_on_media_timeout(switch_channel_t* channel, swit
return _event_dispatch.switch_telnyx_on_media_timeout(channel, rtp_session);
}
return SWITCH_TRUE;
}

void switch_telnyx_channel_event_set_basic_data(switch_channel_t *channel, switch_event_t *event)
{
if (_event_dispatch.switch_telnyx_channel_event_set_basic_data) {
_event_dispatch.switch_telnyx_channel_event_set_basic_data(channel, event);
}
}

0 comments on commit fe1ae15

Please sign in to comment.