[asterisk-dev] Sendtext Problem while bridging

Stefan Schmidt sst at sil.at
Thu May 6 03:42:34 CDT 2010


Hello,

iam trying to patch asterisk 1.6.1.8 in chan_sip.c to use the sendtext 
app to send information to the target phone when doing an attendet transfer.

i´ve done this by using a selfwritten modul where i get some information 
from database and send this via jabber and also i want to send it with 
sendtext.

The modul itself works fine but with sendtext i have the problem that 
message is sent before the final invite is sent to the phone which looks 
like this:

Really sending text Call from +xxx transfered from 1444 on 
SIP/g000258-08535580
set_destination: Parsing <sip:g000258 at xxx:1198> for address/port to send to
set_destination: set destination to xxx, port 1198
Reliably Transmitting (NAT) to xxx:6281:
MESSAGE sip:g000258 at xxx:1198 SIP/2.0
Via: SIP/2.0/UDP xxx:5060;branch=z9hG4bK2dc0f15b;rport
Max-Forwards: 70
From: "yyy" <sip:1444 at xxx>;tag=as5512d863
To: <sip:g000258 at xxx:1198>;tag=19a4660d34dcad1bi1
Call-ID: 777aec4612a991f85240399b6279439f at xxx
Seq: 105 MESSAGE002
User-Agent: PBX
Content-Type: text/plain;charset=UTF-8
Content-Length: 64

Call von +xxx transfered from 1444

directly after the message the invite to finish the transfer ist send 
with Cseq 106

...

-- Native bridging SIP/xxxxxx-b7c04ed8 and SIP/g000258-08535580
<--- SIP read from UDP://xxxx:6281 --->
SIP/2.0 403 Forbidden
To: <sip:g000258 at xxxx:1198>;tag=19a4660d34dcad1bi1
From: "yyyy" <sip:1444 at xxxx>;tag=as5512d863
Call-ID: 777aec4612a991f85240399b6279439f at xxxx
CSeq: 105 MESSAGE
Via: SIP/2.0/UDP xxxx:5060;branch=z9hG4bK2dc0f15b
Server: Cisco/SPA525G-7.4.3
Content-Length: 0

--- (8 headers 0 lines) ---
[May 6 10:26:05] WARNING[32713]: chan_sip.c:16976 handle_response: 
Forbidden - maybe wrong password on authentication for MESSAGE

after this i get the 200ok for cseq 106 and the call is transfered.

my patch of chan_sip.c is just for testing but it looks like this:

ast_debug(4, "SIP transfer: trying to masquerade %s into %s\n", 
peerc->name, peerb->name);
if (ast_channel_masquerade(peerb, peerc)) {
ast_log(LOG_WARNING, "Failed to masquerade %s into %s\n", peerb->name, 
peerc->name);
res = -1;
} else {
struct ast_app *ast_app = pbx_findapp("GetJabber");
if(ast_app)
{
char parametertext[300];
sprintf(parametertext,"Call from %s transfered from 
%s\n",peerc->cid.cid_num,peera->cid.cid_num);
pbx_exec(peerd,ast_app,(void*)parametertext);
}
ast_debug(4, "SIP transfer: Succeeded to masquerade channels.\n");
}

where else could i call the app getjabber which sends the jabber message 
and sendtext so i wont get a forbidden from the phone?

with my self written pickup there i have no problem to use sendtext 
after the masquerade of the channels.

best regards

steve smith




More information about the asterisk-dev mailing list