[OpenSIPS-Users] Modify To:'s field and forward

duane.larson at gmail.com duane.larson at gmail.com
Tue Nov 29 00:27:24 CET 2011


I don't totally follow why you would want to change the "To:" field to just  
prepend "870190" and also remove a "0" from "00522375568", but what you  
want to do is possible. You could use AVP's and add an AVP like this
opensipsctl avp add -T usr_preferences 390522375507 at domain.com is_FAX 0 y

Then in the opensips config do

if (avp_db_load("$fu/username","$avp(is_FAX)"))
{
if (avp_check("$avp(is_FAX)", "eq/y/i"))
{
DO WHAT YOU WANT
}
}




On , spady <spady77 at gmail.com> wrote:
> Hi all, I was wondering if OpenSIPS can help me with scenario explained

> below;



> I have a Fax Server SIP and T38 based. It use a SIP based Pbx as PSTN

> Gateway, so requested external fax number are sent from Fax server toward

> PBX and then forwarded to Pstn.



> Here there's a full SIP trace:

> NOTE:

> 172.16.52.7 = Fax Server

> 10.9.6.3= PBX





> INVITE sip:00522375568 at 10.9.6.3:5060;user=phone SIP/2.0

> Via: SIP/2.0/UDP 172.16.52.7:5061

> *From: Fax Alcatel sip:+390522375507 at 172.16.52.7:5061>;tag=B0A3C63723A2*

> To: sip:00522375568 at 10.9.6.3:5060

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> CSeq: 101 INVITE

> Max-Forwards: 70

> Contact:

> User-Agent: Alcatel-Lucent OmniTouch Fax Server Application/6.5.6.28

> P-Alcatel-CSBU: charging=sip:2542 at ucalcatel.sedoc.locale

> Content-Type: application/sdp

> Content-Length: 235



> v=0

> o=XMedius-Fax-Gateway 79844629 629 IN IP4 172.16.52.7

> s=SIP Fax Call

> c=IN IP4 172.16.52.7

> t=0 0

> m=audio 62186 RTP/AVP 18 8 4

> a=rtpmap:18 G729/8000

> a=fmtp:18 annexb=no

> a=rtpmap:8 PCMA/8000

> a=rtpmap:4 G723/8000

> a=ptime:20

> SIP/2.0 100 Trying

> To: sip:00522375568 at 10.9.6.3:5060

> From: Fax Alcatel sip:+390522375507 at 172.16.52.7:5061>;tag=B0A3C63723A2

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> CSeq: 101 INVITE

> Via: SIP/2.0/UDP 172.16.52.7:5061

> Content-Length: 0



> SIP/2.0 180 Ringing

> Allow: INVITE, ACK, CANCEL, BYE, PRACK, NOTIFY, REFER, SUBSCRIBE, OPTIONS,

> UPDATE

> Contact: sip:10.9.6.3

> User-Agent: OmniPCX Enterprise R9.0 h1.301.50

> P-Alcatel-CSBU: categparty=external

> Content-Type: application/sdp

> To: sip:00522375568 at 10.9.6.3:5060;tag=4d23b434bddc6d2bbdcdeb5b281baf8e

> From: Fax Alcatel sip:+390522375507 at 172.16.52.7:5061>;tag=B0A3C63723A2

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> CSeq: 101 INVITE

> Via: SIP/2.0/UDP 172.16.52.7:5061

> Content-Length: 229



> v=0

> o=OXE 1322519520 1322519520 IN IP4 10.9.6.3

> s=abs

> c=IN IP4 10.9.6.8

> t=0 0

> m=audio 32600 RTP/AVP 18 96

> a=rtpmap:18 G729/8000

> a=fmtp:18 annexb=no

> a=ptime:30

> a=maxptime:40

> a=rtpmap:96 telephone-event/8000

> a=sendrecv

> SIP/2.0 200 OK

> Allow: INVITE, ACK, CANCEL, BYE, PRACK, NOTIFY, REFER, SUBSCRIBE, OPTIONS,

> UPDATE

> Contact: sip:10.9.6.3

> Supported: replaces,timer,100rel

> User-Agent: OmniPCX Enterprise R9.0 h1.301.50

> Session-Expires: 1800;refresher=uas

> P-Alcatel-CSBU: categparty=external

> P-Asserted-Identity: "Lw RE" sip:05223755 at 10.9.6.3;user=phone>

> Content-Type: application/sdp

> To: sip:00522375568 at 10.9.6.3:5060;tag=4d23b434bddc6d2bbdcdeb5b281baf8e

> From: Fax Alcatel sip:+390522375507 at 172.16.52.7:5061>;tag=B0A3C63723A2

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> CSeq: 101 INVITE

> Via: SIP/2.0/UDP 172.16.52.7:5061

> Content-Length: 229



> v=0

> o=OXE 1322519520 1322519521 IN IP4 10.9.6.3

> s=abs

> c=IN IP4 10.9.6.8

> t=0 0

> m=audio 32600 RTP/AVP 18 96

> a=rtpmap:18 G729/8000

> a=fmtp:18 annexb=no

> a=ptime:30

> a=maxptime:40

> a=rtpmap:96 telephone-event/8000

> a=sendrecv

> ACK sip:10.9.6.3 SIP/2.0

> Via: SIP/2.0/UDP 172.16.52.7:5061

> From: Fax Alcatel sip:+390522375507 at 172.16.52.7:5061>;tag=B0A3C63723A2

> To: sip:00522375568 at 10.9.6.3:5060;tag=4d23b434bddc6d2bbdcdeb5b281baf8e

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> Max-Forwards: 70

> CSeq: 101 ACK

> Contact:

> Content-Length: 0



> INVITE sip:+390522375507 at 172.16.52.7:5061;user=phone SIP/2.0

> Allow: INVITE, ACK, CANCEL, BYE, PRACK, NOTIFY, REFER, SUBSCRIBE, OPTIONS,

> UPDATE

> Contact: sip:10.9.6.3

> Supported: replaces,timer,100rel

> User-Agent: OmniPCX Enterprise R9.0 h1.301.50

> Session-Expires: 1800;refresher=uac

> Min-SE: 900

> Content-Type: application/sdp

> To: sip:+390522375507 at 172.16.52.7:5061;tag=B0A3C63723A2

> From: sip:00522375568 at 10.9.6.3:5060;tag=4d23b434bddc6d2bbdcdeb5b281baf8e

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> CSeq: 2033886164 INVITE

> Via: SIP/2.0/UDP 10.9.6.3;branch=z9hG4bK3dec7cf801610f04d0d388ebc2906678

> Max-Forwards: 70

> Content-Length: 268



> v=0

> o=OXE 1322519520 1322519522 IN IP4 10.9.6.3

> s=abs

> c=IN IP4 10.9.6.8

> t=0 0

> m=image 32603 udptl t38

> a=T38FaxVersion:0

> a=T38MaxBitRate:9600

> a=T38FaxRateManagement:transferredTCF

> a=T38FaxMaxBuffer:256

> a=T38FaxMaxDatagram:512

> a=T38FaxUdpEC:t38UDPRedundancy

> INVITE sip:+390522375507 at 172.16.52.7:5061;user=phone SIP/2.0

> Allow: INVITE, ACK, CANCEL, BYE, PRACK, NOTIFY, REFER, SUBSCRIBE, OPTIONS,

> UPDATE

> Contact: sip:10.9.6.3

> Supported: replaces,timer,100rel

> User-Agent: OmniPCX Enterprise R9.0 h1.301.50

> Session-Expires: 1800;refresher=uac

> Min-SE: 900

> Content-Type: application/sdp

> To: sip:+390522375507 at 172.16.52.7:5061;tag=B0A3C63723A2

> From: sip:00522375568 at 10.9.6.3:5060;tag=4d23b434bddc6d2bbdcdeb5b281baf8e

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> CSeq: 2033886164 INVITE

> Via: SIP/2.0/UDP 10.9.6.3;branch=z9hG4bK3dec7cf801610f04d0d388ebc2906678

> Max-Forwards: 70

> Content-Length: 268



> v=0

> o=OXE 1322519520 1322519522 IN IP4 10.9.6.3

> s=abs

> c=IN IP4 10.9.6.8

> t=0 0

> m=image 32603 udptl t38

> a=T38FaxVersion:0

> a=T38MaxBitRate:9600

> a=T38FaxRateManagement:transferredTCF

> a=T38FaxMaxBuffer:256

> a=T38FaxMaxDatagram:512

> a=T38FaxUdpEC:t38UDPRedundancy

> SIP/2.0 200 OK

> Via: SIP/2.0/UDP 10.9.6.3;branch=z9hG4bK3dec7cf801610f04d0d388ebc2906678

> From: sip:00522375568 at 10.9.6.3:5060;tag=4d23b434bddc6d2bbdcdeb5b281baf8e

> To: sip:+390522375507 at 172.16.52.7:5061;tag=B0A3C63723A2

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> CSeq: 2033886164 INVITE

> Allow: INVITE, ACK, BYE, CANCEL

> Contact:

> Server: Alcatel-Lucent OmniTouch Fax Server Application/6.5.6.28

> Content-Type: application/sdp

> Content-Length: 284



> v=0

> o=XMedius-Fax-Gateway 79844629 630 IN IP4 172.16.52.7

> s=abs

> c=IN IP4 172.16.52.7

> t=0 0

> m=image 61169 udptl t38

> a=T38FaxVersion:0

> a=T38MaxBitRate:14400

> a=T38FaxRateManagement:transferredTCF

> a=T38FaxMaxBuffer:8192

> a=T38FaxMaxDatagram:1008

> a=T38FaxUdpEC:t38UDPRedundancy

> SIP/2.0 200 OK

> Via: SIP/2.0/UDP 10.9.6.3;branch=z9hG4bK3dec7cf801610f04d0d388ebc2906678

> From: sip:00522375568 at 10.9.6.3:5060;tag=4d23b434bddc6d2bbdcdeb5b281baf8e

> To: sip:+390522375507 at 172.16.52.7:5061;tag=B0A3C63723A2

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> CSeq: 2033886164 INVITE

> Allow: INVITE, ACK, BYE, CANCEL

> Contact:

> Server: Alcatel-Lucent OmniTouch Fax Server Application/6.5.6.28

> Content-Type: application/sdp

> Content-Length: 284



> v=0

> o=XMedius-Fax-Gateway 79844629 630 IN IP4 172.16.52.7

> s=abs

> c=IN IP4 172.16.52.7

> t=0 0

> m=image 61169 udptl t38

> a=T38FaxVersion:0

> a=T38MaxBitRate:14400

> a=T38FaxRateManagement:transferredTCF

> a=T38FaxMaxBuffer:8192

> a=T38FaxMaxDatagram:1008

> a=T38FaxUdpEC:t38UDPRedundancy

> ACK sip:+390522375507 at 172.16.52.7:5061;user=phone SIP/2.0

> Contact: sip:10.9.6.3

> User-Agent: OmniPCX Enterprise R9.0 h1.301.50

> To: sip:+390522375507 at 172.16.52.7:5061;tag=B0A3C63723A2

> From: sip:00522375568 at 10.9.6.3:5060;tag=4d23b434bddc6d2bbdcdeb5b281baf8e

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> CSeq: 2033886164 ACK

> Via: SIP/2.0/UDP 10.9.6.3;branch=z9hG4bKdbe117b38c900fdd1e039c6cd7b7ebe8

> Max-Forwards: 70

> Content-Length: 0



> UPDATE sip:+390522375507 at 172.16.52.7:5061;user=phone SIP/2.0

> Supported: replaces,timer,100rel

> Session-Expires: 1800;refresher=uac

> Min-SE: 900

> Content-Type: application/sdp

> To: sip:+390522375507 at 172.16.52.7:5061;tag=B0A3C63723A2

> From: sip:00522375568 at 10.9.6.3:5060;tag=4d23b434bddc6d2bbdcdeb5b281baf8e

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> CSeq: 2033886165 UPDATE

> Via: SIP/2.0/UDP 10.9.6.3;branch=z9hG4bKd2a9e02beb6049cbdd09da806b6fb0a4

> Contact: sip:10.9.6.3

> Max-Forwards: 70

> Content-Length: 268



> v=0

> o=OXE 1322519520 1322519522 IN IP4 10.9.6.3

> s=abs

> c=IN IP4 10.9.6.8

> t=0 0

> m=image 32603 udptl t38

> a=T38FaxVersion:0

> a=T38MaxBitRate:9600

> a=T38FaxRateManagement:transferredTCF

> a=T38FaxMaxBuffer:256

> a=T38FaxMaxDatagram:512

> a=T38FaxUdpEC:t38UDPRedundancy

> SIP/2.0 405 Method Not Allowed

> Via: SIP/2.0/UDP 10.9.6.3;branch=z9hG4bKd2a9e02beb6049cbdd09da806b6fb0a4

> From: sip:00522375568 at 10.9.6.3:5060;tag=4d23b434bddc6d2bbdcdeb5b281baf8e

> To: sip:+390522375507 at 172.16.52.7:5061;tag=B0A3C63723A2

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> CSeq: 2033886165 UPDATE

> Allow: INVITE, ACK, BYE, CANCEL

> Contact:

> Server: Alcatel-Lucent OmniTouch Fax Server Application/6.5.6.28

> Content-Length: 0



> INVITE sip:+390522375507 at 172.16.52.7:5061;user=phone SIP/2.0

> Contact: sip:10.9.6.3

> Supported: replaces,timer,100rel

> Session-Expires: 1800;refresher=uac

> Min-SE: 900

> P-Asserted-Identity: "Lw RE" sip:05223755 at 10.9.6.3;user=phone>

> Content-Type: application/sdp

> To: sip:+390522375507 at 172.16.52.7:5061;tag=B0A3C63723A2

> From: sip:00522375568 at 10.9.6.3:5060;tag=4d23b434bddc6d2bbdcdeb5b281baf8e

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> CSeq: 2033886166 INVITE

> Via: SIP/2.0/UDP 10.9.6.3;branch=z9hG4bKacbd9d6325236ef926050d307c0cbf7c

> Max-Forwards: 70

> Content-Length: 268



> v=0

> o=OXE 1322519520 1322519522 IN IP4 10.9.6.3

> s=abs

> c=IN IP4 10.9.6.8

> t=0 0

> m=image 32603 udptl t38

> a=T38FaxVersion:0

> a=T38MaxBitRate:9600

> a=T38FaxRateManagement:transferredTCF

> a=T38FaxMaxBuffer:256

> a=T38FaxMaxDatagram:512

> a=T38FaxUdpEC:t38UDPRedundancy

> SIP/2.0 200 OK

> Via: SIP/2.0/UDP 10.9.6.3;branch=z9hG4bKacbd9d6325236ef926050d307c0cbf7c

> From: sip:00522375568 at 10.9.6.3:5060;tag=4d23b434bddc6d2bbdcdeb5b281baf8e

> To: sip:+390522375507 at 172.16.52.7:5061;tag=B0A3C63723A2

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> CSeq: 2033886166 INVITE

> Allow: INVITE, ACK, BYE, CANCEL

> Contact:

> Server: Alcatel-Lucent OmniTouch Fax Server Application/6.5.6.28

> Content-Type: application/sdp

> Content-Length: 284



> v=0

> o=XMedius-Fax-Gateway 79844629 631 IN IP4 172.16.52.7

> s=abs

> c=IN IP4 172.16.52.7

> t=0 0

> m=image 61169 udptl t38

> a=T38FaxVersion:0

> a=T38MaxBitRate:14400

> a=T38FaxRateManagement:transferredTCF

> a=T38FaxMaxBuffer:8192

> a=T38FaxMaxDatagram:1008

> a=T38FaxUdpEC:t38UDPRedundancy

> ACK sip:+390522375507 at 172.16.52.7:5061;user=phone SIP/2.0

> Contact: sip:10.9.6.3

> User-Agent: OmniPCX Enterprise R9.0 h1.301.50

> To: sip:+390522375507 at 172.16.52.7:5061;tag=B0A3C63723A2

> From: sip:00522375568 at 10.9.6.3:5060;tag=4d23b434bddc6d2bbdcdeb5b281baf8e

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> CSeq: 2033886166 ACK

> Via: SIP/2.0/UDP 10.9.6.3;branch=z9hG4bK892a68e34cf81bf95ff183b4fed740eb

> Max-Forwards: 70

> Content-Length: 0



> BYE sip:10.9.6.3 SIP/2.0

> Via: SIP/2.0/UDP 172.16.52.7:5061

> From: sip:+390522375507 at 172.16.52.7:5061;tag=B0A3C63723A2

> To: sip:00522375568 at 10.9.6.3:5060;tag=4d23b434bddc6d2bbdcdeb5b281baf8e

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> CSeq: 102 BYE

> Max-Forwards: 70

> Contact:

> User-Agent: Alcatel-Lucent OmniTouch Fax Server Application/6.5.6.28

> Content-Length: 0



> SIP/2.0 200 OK

> Allow: INVITE, ACK, CANCEL, BYE, PRACK, NOTIFY, REFER, SUBSCRIBE, OPTIONS,

> UPDATE

> Supported: replaces,timer,100rel

> User-Agent: OmniPCX Enterprise R9.0 h1.301.50

> To: sip:00522375568 at 10.9.6.3:5060;tag=4d23b434bddc6d2bbdcdeb5b281baf8e

> From: sip:+390522375507 at 172.16.52.7:5061;tag=B0A3C63723A2

> Call-ID: 8f917371-ff97-4953-bc3d-fdba788fe45a at 172.16.52.7

> CSeq: 102 BYE

> Via: SIP/2.0/UDP 172.16.52.7:5061

> Content-Length: 0





> So, what I would like that OpenSIPS do for me is analyze "FROM" header  
> into

> first INVITE message than query a DB and if query matches then modify the

> "TO:" header.



> Example:



> From: Fax Alcatel sip:+390522375507 at 172.16.52.7:5061>;tag=B0A3C63723A2



> Here OPENSIPS should analyze "+390522375507" then if query is ok modify



> To: sip:00522375568 at 10.9.6.3:5060



> into



> To: sip:870190522375568 at 10.9.6.3:5060



> Is this possible????

> Naturally I will put OpenSIPS in the middle between Fax server and PBX and

> fax server, as SIP PEER, will points to OpenSIPS ( OpenSIPS then will be  
> in

> charge of forward everything to PBX ).



> What do you think???



> Thanks a lot for your replies.





> --

> View this message in context:  
> http://opensips-open-sip-server.1449251.n2.nabble.com/Modify-To-s-field-and-forward-tp7040781p7040781.html

> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.



> _______________________________________________

> Users mailing list

> Users at lists.opensips.org

> http://lists.opensips.org/cgi-bin/mailman/listinfo/users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20111128/559401da/attachment-0001.htm>


More information about the Users mailing list