mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 10:33:13 +00:00
stasis_channels.c: Make protocol_id optional to enable blind transfer via ari
When handling SIP transfers via ARI, there is no protocol_id in case of a blind transfer. Resolves: #1467
This commit is contained in:
@@ -1659,13 +1659,16 @@ static struct ast_json *ari_transfer_to_json(struct stasis_message *msg,
|
|||||||
const struct timeval *tv = stasis_message_timestamp(msg);
|
const struct timeval *tv = stasis_message_timestamp(msg);
|
||||||
struct ast_ari_transfer_message *transfer_msg = stasis_message_data(msg);
|
struct ast_ari_transfer_message *transfer_msg = stasis_message_data(msg);
|
||||||
|
|
||||||
dest_json = ast_json_pack("{s: s, s: s}",
|
dest_json = ast_json_pack("{s: s}", "destination", transfer_msg->destination);
|
||||||
"protocol_id", transfer_msg->protocol_id,
|
|
||||||
"destination", transfer_msg->destination);
|
|
||||||
if (!dest_json) {
|
if (!dest_json) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (transfer_msg->protocol_id) {
|
||||||
|
ast_json_object_set(dest_json, "protocol_id",
|
||||||
|
ast_json_string_create(transfer_msg->protocol_id));
|
||||||
|
}
|
||||||
|
|
||||||
if (AST_VECTOR_SIZE(transfer_msg->refer_params) > 0) {
|
if (AST_VECTOR_SIZE(transfer_msg->refer_params) > 0) {
|
||||||
struct ast_json *params = ast_json_array_create();
|
struct ast_json *params = ast_json_array_create();
|
||||||
if (!params) {
|
if (!params) {
|
||||||
@@ -1799,11 +1802,14 @@ struct ast_ari_transfer_message *ast_ari_transfer_message_create(struct ast_chan
|
|||||||
}
|
}
|
||||||
|
|
||||||
ast_copy_string(msg->destination, exten, sizeof(msg->destination));
|
ast_copy_string(msg->destination, exten, sizeof(msg->destination));
|
||||||
|
|
||||||
|
if (protocol_id) {
|
||||||
msg->protocol_id = ast_strdup(protocol_id);
|
msg->protocol_id = ast_strdup(protocol_id);
|
||||||
if (!msg->protocol_id) {
|
if (!msg->protocol_id) {
|
||||||
ao2_cleanup(msg);
|
ao2_cleanup(msg);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user