[Home]

Summary:ASTERISK-08003: [patch] problem with simple transfer of incoming call
Reporter:Sergey Tamkovich (sergee)Labels:
Date Opened:2006-10-25 09:05:47Date Closed:2006-10-31 06:23:26.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Resources/res_features
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) transfer-r46194.diff
Description:User A calls to user B and B transfers the call to user C
this simple transfer fails.

****** ADDITIONAL INFORMATION ******

User A calls to user B, user B answers the call, 2 channels are created in this case - channel for user A and channel for user B.

In this case only first channel (A) would have values in fields
chana->context
chana->exten
chana->priority
same fields for channel B would be blank!

so when user B trying to transfer the call, function real_ctx(chanb,chana) - would be called from res_features.c



static const char *real_ctx(struct ast_channel *transferer, struct ast_channel *transferee)
{
       const char *s = pbx_builtin_getvar_helper(transferer, "TRANSFER_CONTEXT");
       ast_log(LOG_DEBUG,"");
       if (ast_strlen_zero(s))
               s = pbx_builtin_getvar_helper(transferee, "TRANSFER_CONTEXT");
       if (ast_strlen_zero(s)) /* Use the non-macro context to transfer the call XXX ? */
               s = transferer->macrocontext;
       if (ast_strlen_zero(s))
               s = transferer->context;
       return s;
}


This function will fail if you didn't define variable TRANSFER_CONTEXT, because transferer == chanb and chanb->context is blank, so real_ctx() will return blank value and transfer of call will fail.


static const char *real_ctx(struct ast_channel *transferer, struct ast_channel *transferee)
{
       const char *s = pbx_builtin_getvar_helper(transferer, "TRANSFER_CONTEXT");
       ast_log(LOG_DEBUG,"");
       if (ast_strlen_zero(s))
               s = pbx_builtin_getvar_helper(transferee, "TRANSFER_CONTEXT");
       if (ast_strlen_zero(s)) /* Use the non-macro context to transfer the call XXX ? */
               s = transferer->macrocontext;
       if (ast_strlen_zero(s))
               s = transferer->context;
       if (ast_strlen_zero(s))
               s = transferee->macrocontext;
       if (ast_strlen_zero(s))
               s = transferee->context;
       return s;
}



Solution of this problem is simple - just add 2 more if-s in real_ctx() and it will work properly.
Comments:By: Sergey Tamkovich (sergee) 2006-10-25 11:32:56

i'm not sure if we need to look at transferer's parameters at all, what do you think?

By: flot (flot) 2006-10-26 09:06:08

Very good patch!

By: Olle Johansson (oej) 2006-10-31 06:01:20.000-0600

The transferer is the one that issues the transfer. Any context we use has to belong to him. Allowing the transferer to transfer into the context of the transferee seems to me like a potential security hole.

By: Olle Johansson (oej) 2006-10-31 06:23:26.000-0600

Agreed with sergee about closing this issue, due to security concerns. In SIP we do set the callee's context in the channel.