Hello!
I am trying to implement Call forwarding.
Server runs openser 1.0.0 and I have a Cisco PSTN GW where only defined
calling numbers are permitted (because of accounting on the "upstream"
provider). My problem is when a call from PSTN is beeing forwarded and
I have to "turn it back" to the PSTN gatway.
Calls from :
1) Sip server ---> SIP-CALL-FW ---> PSTN GW OK, the calling number is
also changed to the number which has turned call forwarding on. The
display on the phone also showing the number which has turned Call
forwarding on..
2) PSTN ---> SIP-CALL-FW ---> SIP SERVER Works OK
3) PSTN ----> SIP-CALL-FW ---> PSTN is not working. Dialpeer matching
in Cisco not OK because calling number not OK. I can define a way so
that all calls can go through the GW. Then I sometimes get a "482 loop
detected". The disply on the phone showing the orginal calling number
(not the number wich hat turnd Call forwarding on).
Is this the right way to "turn" a call back to where it came from? Have
a missed a "rebuild" of the message?
if (avp_db_load("$ruri","$fw_to") & method=="INVITE") {
# CALL Forward
log(1, "INFO: AVP_db_load fw_to true \n");
#save called number
avp_write("$ruri/username","s:org_to");
#Insert call forward number
avp_pushto("$ruri/username","$fw_to");
#is call forward number local or to PSTN
if (does_uri_exist()) {
log(1, "INFO:Call FW to Local users\n");
if (!lookup("location")) {
log(1, "INFO: call FW to local user, not
online\n");
route(4);
return;
};
log(1, "INFO:Call FW to local users online\n");
uac_replace_from("$avp(s:org_to)","sip:$avp(s:org_to)@212.125.213.151:5060");
if (!t_relay()) {
sl_reply_error();
return;
};
return;
} else {
log(1, "INFO: Call FW to PSTN\n");
#here is somting wrong. What???
#move Called number as From number and send to PSTN GW
uac_replace_from("$avp(s:org_to)","sip:$avp(s:org_to)@212.125.213.151:5060");
rewritehostport("80.239.101.34:5060");
append_hf("P-hint: call fwd to PSTN\r\n");
append_branch();
record_route();
if (!t_relay()) {
sl_reply_error();
return;
};
};
return;
}
Cisco trace : calling from 38092382 (PSTN) to 38707130 (on the SIP
server) witch is forwarded to 95066833 (PSTN)
Call comming in from PSTN to SIP-server :
Sent: (from Cisco)
INVITE sip:38707130@212.125.213.151:5060 SIP/2.0
Via: SIP/2.0/UDP 80.239.101.34:5060;branch=z9hG4bK69972
From: <sip:38092382@80.239.101.34>;tag=2A699224-CC6
To: <sip:38707130@212.125.213.151>
Date: Fri, 02 Dec 2005 18:41:38 GMT
Call-ID: 1B42584B-629A11DA-AFCCC9A9-E3CBCB60(a)80.239.101.34
Supported: 100rel,timer
Min-SE: 1800
Cisco-Guid: 457212883-1654264282-2767847443-3293903248
User-Agent: Cisco-SIPGateway/IOS-12.x
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER,
SUBSCRIBE, NOTIFY, INFO, UPDATE, REGISTER
CSeq: 101 INVITE
Max-Forwards: 70
Remote-Party-ID:
<sip:38092382@80.239.101.34>;party=calling;screen=yes;privacy=off
Timestamp: 1133548898
Contact: <sip:38092382@80.239.101.34:5060>
Expires: 180
Allow-Events: telephone-event
Content-Type: application/sdp
Content-Length: 253
v=0
o=CiscoSystemsSIP-GW-UserAgent 6274 5968 IN IP4 80.239.101.34
s=SIP Call
c=IN IP4 80.239.101.34
t=0 0
m=audio 16788 RTP/AVP 18 8 0
c=IN IP4 80.239.101.34
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
*Dec 2 18:41:38.278: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg:
Received:
SIP/2.0 100 trying -- your call is important to us
Via: SIP/2.0/UDP 80.239.101.34:5060;branch=z9hG4bK69972
From: <sip:38092382@80.239.101.34>;tag=2A699224-CC6
To: <sip:38707130@212.125.213.151>
Call-ID: 1B42584B-629A11DA-AFCCC9A9-E3CBCB60(a)80.239.101.34
CSeq: 101 INVITE
Server: OpenSer (1.0.0 (i386/linux))
Content-Length: 0
Warning: 392 212.125.213.151:5060 "Noisy feedback tells: pid=29232
req_src_ip=80.239.101.34 req_src_port=55717
in_uri=sip:38707130@212.125.213.151:5060
out_uri=sip:95066833@80.239.101.34:5060 via_cnt==1"
*Dec 2 18:41:38.282: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg:
Received:
INVITE sip:95066833@80.239.101.34:5060 SIP/2.0
Record-Route: <sip:212.125.213.151;ftag=2A699224-CC6;lr=on>
Via: SIP/2.0/UDP 212.125.213.151;branch=z9hG4bK1e4.11a1a9d3.0
Via: SIP/2.0/UDP 80.239.101.34:5060;branch=z9hG4bK69972
From: <sip:38707130@212.125.213.151:5060>;tag=2A699224-CC6
To: <sip:38707130@212.125.213.151>
Date: Fri, 02 Dec 2005 18:41:38 GMT
Call-ID: 1B42584B-629A11DA-AFCCC9A9-E3CBCB60(a)80.239.101.34
Supported: 100rel,timer
Min-SE: 1800
Cisco-Guid: 457212883-1654264282-2767847443-3293903248
User-Agent: Cisco-SIPGateway/IOS-12.x
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER,
SUBSCRIBE, NOTIFY, INFO, UPDATE, REGISTER
CSeq: 101 INVITE
Max-Forwards: 69
Remote-Party-ID:
<sip:38092382@80.239.101.34>;party=calling;screen=yes;privacy=off
Timestamp: 1133548898
Contact: <sip:38092382@80.239.101.34:5060>
Expires: 180
Allow-Events: telephone-event
Content-Type: application/sdp
Content-Length: 253
P-hint: call fwd to PSTN
v=0
o=CiscoSystemsSIP-GW-UserAgent 6274 5968 IN IP4 80.239.101.34
s=SIP Call
c=IN IP4 80.239.101.34
t=0 0
m=audio 16788 RTP/AVP 18 8 0
c=IN IP4 80.239.101.34
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
Dial peer maching (call forward from SIP server). Calling number is
wrong, should be 38707130 (number who has put forwarding on)
Calling Number=38092382, Called Number=95066833, Voice-Interface=0x0,
Timeout=TRUE, Peer Encap Type=ENCAP_VOIP, Peer Search
Type=PEER_TYPE_VOICE,
Peer Info Type=DIALPEER_INFO_SPEECH
*Dec 2 19:44:08.330: //-1/D6732AD9A532/DPM/dpAssociateIncomingPeerCore:
Result=NO_MATCH(-1) After All Match Rules Attempt
*Dec 2 19:44:08.334: //-1/D6732AD9A532/DPM/dpMatchPeersCore:
Calling Number=, Called Number=95066833, Peer Info
Type=DIALPEER_INFO_SPEECH
*Dec 2 19:44:08.334: //-1/D6732AD9A532/DPM/dpMatchPeersCore:
Match Rule=DP_MATCH_DEST; Called Number=95066833
Best regards
Kjell Arild