diff options
-rw-r--r-- | res/res_pjsip_header_funcs.c | 10 | ||||
-rw-r--r-- | res/res_pjsip_messaging.c | 10 |
2 files changed, 12 insertions, 8 deletions
diff --git a/res/res_pjsip_header_funcs.c b/res/res_pjsip_header_funcs.c index 7425d8f59..11ab44c10 100644 --- a/res/res_pjsip_header_funcs.c +++ b/res/res_pjsip_header_funcs.c @@ -452,6 +452,11 @@ static int func_read_header(struct ast_channel *chan, const char *function, char AST_APP_ARG(header_name); AST_APP_ARG(header_number);); AST_STANDARD_APP_ARGS(args, data); + if (!channel) { + ast_log(LOG_ERROR, "This function requires a PJSIP channel.\n"); + return -1; + } + if (ast_strlen_zero(args.action)) { ast_log(AST_LOG_ERROR, "This function requires an action.\n"); return -1; @@ -506,6 +511,11 @@ static int func_write_header(struct ast_channel *chan, const char *cmd, char *da AST_APP_ARG(header_name); AST_APP_ARG(header_number);); AST_STANDARD_APP_ARGS(args, data); + if (!channel) { + ast_log(LOG_ERROR, "This function requires a PJSIP channel.\n"); + return -1; + } + if (ast_strlen_zero(args.action)) { ast_log(AST_LOG_ERROR, "This function requires an action.\n"); return -1; diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c index c2dea7f19..b66ee0b11 100644 --- a/res/res_pjsip_messaging.c +++ b/res/res_pjsip_messaging.c @@ -431,15 +431,9 @@ static enum pjsip_status_code rx_data_to_ast_msg(pjsip_rx_data *rdata, struct as CHECK_RES(ast_msg_set_from(msg, "%s", buf)); } - /* contact header */ - if ((size = pjsip_hdr_print_on(pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, NULL), buf, sizeof(buf)-1)) > 0) { - buf[size] = '\0'; - CHECK_RES(ast_msg_set_var(msg, "SIP_FULLCONTACT", buf)); - } - /* receive address */ field = pj_sockaddr_print(&rdata->pkt_info.src_addr, buf, sizeof(buf)-1, 1); - CHECK_RES(ast_msg_set_var(msg, "SIP_RECVADDR", field)); + CHECK_RES(ast_msg_set_var(msg, "PJSIP_RECVADDR", field)); /* body */ if (print_body(rdata, buf, sizeof(buf) - 1) > 0) { @@ -448,7 +442,7 @@ static enum pjsip_status_code rx_data_to_ast_msg(pjsip_rx_data *rdata, struct as /* endpoint name */ if (endpt->id.self.name.valid) { - CHECK_RES(ast_msg_set_var(msg, "SIP_PEERNAME", endpt->id.self.name.str)); + CHECK_RES(ast_msg_set_var(msg, "PJSIP_PEERNAME", endpt->id.self.name.str)); } CHECK_RES(headers_to_vars(rdata, msg)); |