[Home]

Summary:ASTERISK-07497: [patch] Cannot transfer via REFER
Reporter:R. Voermans (voermans)Labels:
Date Opened:2006-08-09 08:10:50Date Closed:2011-06-07 14:07:58
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/Transfers
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) bug7694-asterisk-1.2.txt
( 1) callpark.txt
( 2) callpark-full.txt
Description:I'm trying to transfer an active phonecall to a parkinglot via my phone's park-softbutton. The phone sends a REFER to Asterisk, asterisk answers with 202 Accepted, but then sends an 'empty' NOTIFY. The logfile states 'No field 'Call-ID' present to copy'. The logfile also states: Transfer attempted without dual ownership?

What exactly does this last message mean? Attached is a debug with the relevant part (from the REFER). More important: what is causing the REFER not to finish correctly?
Comments:By: Serge Vecher (serge-v) 2006-08-09 10:15:21

ok, please include a log of a complete call flow, not just a problematic snippet. Thanks.

By: R. Voermans (voermans) 2006-08-09 14:17:06

OK, Attached is the full log of the call flow. Since this is a production environment (and don't have a test-lab available at the moment), a lot of extra sip-messages are passing by. However, the full callflow is available in the logs...

By: Serge Vecher (serge-v) 2006-08-09 14:28:49

strange. Any modifications done to the source code?

By: R. Voermans (voermans) 2006-08-09 14:33:06

Yes, only one modification in chan_sip.c on line 11060 (function handle_request_subscribe), in order to make BLF work on the Thomson ST2030 phone:

                               } else if (strstr(p->useragent, "THOMSON")) {
                                       p->subscribed = DIALOG_INFO_XML; /* Thomson 2030 phones do not send a proper Accept: header */

By: Joshua C. Colp (jcolp) 2006-08-16 13:25:32

I need some more information about the call flow, if I'm reading right it's like this:

1. Phone 1 calls Phone 2
2. Phone 1 wants to park Phone 2
3. Phone 1 sends REFER To park Phone 2
4. Asterisk freaks

Is this correct?

By: R. Voermans (voermans) 2006-08-16 13:27:26

Almost correct.

Step 1 is: phone 2 calls phone 1

By: garyhai (garyhai) 2006-08-16 20:05:22

In this function:
static int transmit_refer(struct sip_pvt *p, const char *dest)
There is a line not in right position:
add_header(&req, "Max-Forwards", DEFAULT_MAX_FORWARDS);
Should move the line above below this line:
reqprep(&req, p, SIP_REFER, 0, 1);

By: R. Voermans (voermans) 2006-08-17 02:17:59

? I don't know exactly what you mean. Where should I put this line? Next: you state that the line has to be in the function transmit_refer. But Asterisk doesn't need to transmit the REFER. It is receiving the REFER!

By: garyhai (garyhai) 2006-08-17 03:06:44

It is a memory operation bug may cause crash of asterisk or other unpredicted result. The add_header function access an uninitialized memory.

By: R. Voermans (voermans) 2006-08-17 03:10:46

OK,

So here's the important part of chan_sip.c:

       /* save in case we get 407 challenge */
       ast_copy_string(p->refer_to, referto, sizeof(p->refer_to));
       ast_copy_string(p->referred_by, p->our_contact, sizeof(p->referred_by));

       reqprep(&req, p, SIP_REFER, 0, 1);
       add_header(&req, "Refer-To", referto);
       if (!ast_strlen_zero(p->our_contact))
               add_header(&req, "Referred-By", p->our_contact);
       add_blank_header(&req);
       return send_request(p, &req, 1, p->ocseq);
}

Where should I put in the line you suggest? Sorry for asking, but i'm not a programming expert!

By: garyhai (garyhai) 2006-08-17 03:26:09

/* Revision: 40010: in function of transmit_refer(), from */

add_header(&req, "Max-Forwards", DEFAULT_MAX_FORWARDS);

/* save in case we get 407 challenge */
sip_refer_allocate(p);
ast_copy_string(p->refer->refer_to, referto, sizeof(p->refer->refer_to));
ast_copy_string(p->refer->referred_by, p->our_contact, sizeof(p->refer->referred_by));
p->refer->status = REFER_SENT;   /* Set refer status */

reqprep(&req, p, SIP_REFER, 0, 1);
add_header(&req, "Refer-To", referto);
add_header(&req, "Allow", ALLOWED_METHODS);
add_header(&req, "Supported", SUPPORTED_EXTENSIONS);

/////////////////////////////////////////////
/* to */

/* save in case we get 407 challenge */
sip_refer_allocate(p);
ast_copy_string(p->refer->refer_to, referto, sizeof(p->refer->refer_to));
ast_copy_string(p->refer->referred_by, p->our_contact, sizeof(p->refer->referred_by));
p->refer->status = REFER_SENT;   /* Set refer status */

reqprep(&req, p, SIP_REFER, 0, 1);
add_header(&req, "Max-Forwards", DEFAULT_MAX_FORWARDS);
add_header(&req, "Refer-To", referto);
add_header(&req, "Allow", ALLOWED_METHODS);
add_header(&req, "Supported", SUPPORTED_EXTENSIONS);

By: R. Voermans (voermans) 2006-08-17 04:23:55

garyhai: I think you are referring to the trunk of SVN. I'm using the 'release' branch. That piece of code isn't in my chan_sip.c. It's just the code I was quoting...

By: Serge Vecher (serge-v) 2006-08-17 08:47:34

garyhai: since you've found a bug in trunk, please file that in a separate bug report. The Refer/Transfer handling is very different between the release and 1.2.x release branch, because oej has rewritten that portion of chan_sip. Thanks

By: Serge Vecher (serge-v) 2006-08-17 08:47:49



By: Olle Johansson (oej) 2006-08-30 14:51:53

garyhai: Your fix is not related to this bug report, but appreciated anyway. Fixed in svn trunk, rev 41437

By: jmls (jmls) 2006-11-01 06:33:22.000-0600

so, where are we with this bug ?

By: Olle Johansson (oej) 2006-11-07 02:21:26.000-0600

That NOTIFY is very, very broken.

By: Olle Johansson (oej) 2006-11-07 02:34:34.000-0600

The transfer fails, but the source code does not realize it and send an error message to the phone. I don't think this type of transfer works in Asterisk 1.2 at all. In Asterisk 1.4, I've rewritten most of the transfer code.

Test this patch, and you will at least get an error message. Please confirm whether it works and stops asterisk from sending that bogus notify, even if it not fixes your problem - the park button.

By: Olle Johansson (oej) 2006-12-05 13:48:38.000-0600

Waiting for feedback.

By: Olle Johansson (oej) 2006-12-07 04:46:48.000-0600

Will have to close this bug report if I don't get any feedback soon.

By: Olle Johansson (oej) 2006-12-29 05:05:49.000-0600

Last call for replies!

By: Joshua C. Colp (jcolp) 2007-01-10 23:56:35.000-0600

I'll slip in here and close this since it's been almost two weeks since oej's last note.