From 99ba73c4a0135f8ffb9b1fb949c03afabf7d02f7 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 24 Sep 2008 21:19:29 +0000 Subject: [PATCH] add handy functions git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9641 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_channel.h | 3 +++ src/switch_channel.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index f466db6177..e62a22a1ee 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -112,6 +112,9 @@ SWITCH_DECLARE(switch_call_cause_t) switch_channel_str2cause(_In_ const char *st */ SWITCH_DECLARE(switch_call_cause_t) switch_channel_get_cause(_In_ switch_channel_t *channel); +SWITCH_DECLARE(switch_call_cause_t) switch_channel_cause_q850(switch_call_cause_t cause); +SWITCH_DECLARE(switch_call_cause_t) switch_channel_get_cause_q850(switch_channel_t *channel); + /*! \brief return a cause string for a given cause \param cause the code to check diff --git a/src/switch_channel.c b/src/switch_channel.c index c9fbf1fbb9..1fa12c550b 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -165,6 +165,20 @@ SWITCH_DECLARE(switch_call_cause_t) switch_channel_get_cause(switch_channel_t *c return channel->hangup_cause; } +SWITCH_DECLARE(switch_call_cause_t) switch_channel_cause_q850(switch_call_cause_t cause) +{ + if (cause <= SWITCH_CAUSE_INTERWORKING) { + return cause; + } else { + return SWITCH_CAUSE_NORMAL_CLEARING; + } +} + +SWITCH_DECLARE(switch_call_cause_t) switch_channel_get_cause_q850(switch_channel_t *channel) +{ + return switch_channel_cause_q850(channel->hangup_cause); +} + SWITCH_DECLARE(switch_channel_timetable_t *) switch_channel_get_timetable(switch_channel_t *channel) { switch_channel_timetable_t *times = NULL;