mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
chan_pjsip, app_transfer: Add TRANSFERSTATUSPROTOCOL variable
When a Transfer/REFER is executed, TRANSFERSTATUSPROTOCOL variable is 0 when no protocl specific error SIP example of failure, 3xx-6xx for the SIP error code received This allows applications to perform actions based on the failure reason. ASTERISK-29252 #close Reported-by: Dan Cropp Change-Id: Ia6a94784b4925628af122409cdd733c9f29abfc4
This commit is contained in:
@@ -6486,9 +6486,31 @@ int ast_call(struct ast_channel *chan, const char *addr, int timeout)
|
||||
\arg the manager interface
|
||||
*/
|
||||
int ast_transfer(struct ast_channel *chan, char *dest)
|
||||
{
|
||||
int protocol;
|
||||
return ast_transfer_protocol(chan, dest, &protocol);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Transfer a call to dest, if the channel supports transfer
|
||||
|
||||
\param chan channel to transfer
|
||||
\param dest destination to transfer to
|
||||
\param protocol is the protocol result
|
||||
SIP example, 0=success, 3xx-6xx is SIP error code
|
||||
|
||||
Called by:
|
||||
\arg app_transfer
|
||||
\arg the manager interface
|
||||
*/
|
||||
int ast_transfer_protocol(struct ast_channel *chan, char *dest, int *protocol)
|
||||
{
|
||||
int res = -1;
|
||||
|
||||
if (protocol) {
|
||||
*protocol = 0;
|
||||
}
|
||||
|
||||
/* Stop if we're a zombie or need a soft hangup */
|
||||
ast_channel_lock(chan);
|
||||
if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) {
|
||||
@@ -6522,6 +6544,13 @@ int ast_transfer(struct ast_channel *chan, char *dest)
|
||||
res = 1;
|
||||
} else {
|
||||
res = -1;
|
||||
/* Message can contain a protocol specific code
|
||||
AST_TRANSFER_SUCCESS indicates success
|
||||
Else, failure. Protocol will be set to the failure reason.
|
||||
SIP example, 0 is success, else error code 3xx-6xx */
|
||||
if (protocol) {
|
||||
*protocol = *message;
|
||||
}
|
||||
}
|
||||
|
||||
ast_frfree(fr);
|
||||
|
Reference in New Issue
Block a user