summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--channels/chan_pjsip.c14
-rw-r--r--channels/chan_sip.c3
-rw-r--r--res/res_pjsip_sdp_rtp.c3
3 files changed, 15 insertions, 5 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index d3ba0a283..9603f0514 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -1811,9 +1811,17 @@ static int hangup(void *data)
static int chan_pjsip_hangup(struct ast_channel *ast)
{
struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);
- struct chan_pjsip_pvt *pvt = channel->pvt;
- int cause = hangup_cause2sip(ast_channel_hangupcause(channel->session->channel));
- struct hangup_data *h_data = hangup_data_alloc(cause, ast);
+ struct chan_pjsip_pvt *pvt;
+ int cause;
+ struct hangup_data *h_data;
+
+ if (!channel || !channel->session) {
+ return -1;
+ }
+
+ pvt = channel->pvt;
+ cause = hangup_cause2sip(ast_channel_hangupcause(channel->session->channel));
+ h_data = hangup_data_alloc(cause, ast);
if (!h_data) {
goto failure;
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 1888091b8..e385ddb53 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -24527,10 +24527,9 @@ static void *sip_pickup_thread(void *stuff)
struct ast_channel *chan;
chan = stuff;
+ ast_channel_hangupcause_set(chan, AST_CAUSE_NORMAL_CLEARING);
if (ast_pickup_call(chan)) {
ast_channel_hangupcause_set(chan, AST_CAUSE_CALL_REJECTED);
- } else {
- ast_channel_hangupcause_set(chan, AST_CAUSE_NORMAL_CLEARING);
}
ast_hangup(chan);
ast_channel_unref(chan);
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 7b705ae25..f7fd5b85f 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -611,6 +611,9 @@ static enum ast_sip_session_media_encryption get_media_encryption_type(pj_str_t
*optimistic = 0;
+ if (!transport_str) {
+ return AST_SIP_MEDIA_TRANSPORT_INVALID;
+ }
if (strstr(transport_str, "UDP/TLS")) {
return AST_SIP_MEDIA_ENCRYPT_DTLS;
} else if (strstr(transport_str, "SAVP")) {