I try to rewrite contact field in sip hf because of fix_nat_contact() fail with this diagram
-----ppp0[ ser/nathelper ] eth0----private network debian 3.1
when agents send INVITE or REGISTER to ser which listen on ppp0 the ip address in contact sip hf stay a private ip address, why ?
I try siproxd which rewrite it . how can i build a ser.cfg in order to contact in sip hf will be rewritte
Harry
___________________________________________________________________________ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com
Perhaps you are using fix_nat_contact() when you should be using fix_nat_register().
Note that fix_nat_register() should ONLY be called when a REGISTER method has been received.
The example below uses a couple of M4 defines, but otherwise might work for you. If you have any questions about the statements below, please review the documentation available online at openser.org, onsip.org or iptel.org
#---------------------------------------------------------------------- # NAT Detection #---------------------------------------------------------------------- if (!search("^Contact:[ ]**") && nat_uac_test("19")) { setflag(FLAG_NAT_CALLER); setflag(FLAG_NAT_PING); fix_nated_register(); force_rport(); };
Regards, Norm
p.s. In regard to your previous problems with devices registered to Asterisk, I found that it is a much better idea to have all of the SIP devices register with (Open)SER instead of Asterisk. This solution may not be right for you, but it's the way we prefer to do things.
harry gaillac wrote:
Harry,
Please do not email me directly. I will only respond to emails directed to the mailing list.
To answer the questions you directed to me privately:
1) Perhaps if you post your complete .cfg file, someone on the list will be able to assist you. There is a very good discussion of NAT registrations at the onsip.org web site. Are you 100% positive that your code snippet is being executed during a REGISTER message ? You might want to put some xlog() statements in your configuration file to make sure that the fix_nated_register() is being executed correctly.
2) I use a flag called FLAG_NAT_CALLER so that the rest of the configuration file can test the flag to determine if the CALLER is behind a NAT and take appropriate actions if that is the case. In the code snippet you sent to me, you are using setflag(7). I have no idea what this is, but I'll bet that it serves a similar purpose to my FLAG_NAT_CALLER.
3) Music-on-hold works for us in the situations where it is needed.
Regards, Norm
Norman Brandinger wrote:
I post my ser.cfg
# -- registrar params -- modparam("registrar", "nat_flag", 7) modparam("registrar", "use_domain", 1)
I don't understand how this flag could help to rewrite th sip contact header.
Can you explain me ? SER is not a PBX what about IVR ACD VOICEMAIL and more that's why I whish using asterisk for telephony features and SER as sip router .
Harry
#----------------------------------------------------------------------
# NAT Detection
#----------------------------------------------------------------------
___________________________________________________________________________
___________________________________________________________________________ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com
I took a look at the configuration you attached. It looks like you are executing fix_nated_contact just before the save("location"). This might be where your problem is. Try removing the fix_nated_contact().
There has been considerable discussion on the mailing lists in regard to fix_nated_contact(). A result of this discussion was the creation of the fix_nated_registere() function. Please review the mailing lists. For example, enter "fix_nated_register site:mail.iptel.org" into a google search.
I provided an example of a REGISTER block in a document about Scripting using M4. The example can be located at: http://openser.org/docs/scripting.html#id2428967 The key point about the example is that fix_nated_contact() is NOT being used during REGISTER processing.
I think that your second question is more along the lines of "how to get (Open)SER and Asterisk to work together to provide music-on-hold, voicemail, ivr, etc". I would suggest that you review the mailing lists because these topics have been discussed quite a lot. I think that a good starting point may also be to visit the onsip.org web site and review their documentation and example configurations.
Regards, Norm
harry gaillac wrote:
Hello Norman,
In fact i add fix_nated_contact() by expecting src_ip would not change and unlike sip contact in header field .
my ser.cfg :
route[2] { ############################ # Register Message Handler # ############################
if (nat_uac_test("19")) { setflag(7); force_rport(); fix_nated_register(); };
if (!www_authorize("", "subscriber")) { www_challenge("", "0"); sl_send_reply("401", "Unauthorized"); break; };
if (!is_from_local()) { sl_send_reply("401", "Unauthorized"); break; };
consume_credentials();
if (!save("location")) { sl_reply_error(); break; }; m_dump(); }
Ok i can't fix this problem however it's not impossible .
Kinds Regards Harry
___________________________________________________________________________ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com