<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    If I understood you right you just need to rewrite R-URI domain and
    forward MESSAGE if a user in not registered.<br>
    <br>
    if (!lookup("location")) {<br>
    &nbsp;&nbsp;&nbsp; switch($retcode) {<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case -1:<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $rd = "gatewaydomain.com";<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; t_relay();<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; exit;<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; default:<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sl_send_reply("404", "Not Found");<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; exit;<br>
    &nbsp;&nbsp;&nbsp; }<br>
    }<br>
    <br>
    <blockquote
cite="mid:CAM5Na1iPUm4dvicoEAs94yBsuMK-P8eX=BEpe4jnsuap_N5YsA@mail.gmail.com"
      type="cite"><br>
      I am trying to route SIP messages to a gateway. I am using SIP
      MESSAGE over UDP as well as the MSILO module for storing messages
      for users that aren't currently logged in. I have read through the
      Dynamic Routing module info but am not able to determine the best
      way to accomplish the routing I require. Our scenario is outlined
      below.<br>
      <br>
      User A sends a message addressed to "<a moz-do-not-send="true"
        href="mailto:sip%3A12345678900@mydomain.com">sip:12345678900@mydomain.com</a>"<br>
      Kamailio at <a moz-do-not-send="true" href="http://mydomain.com">mydomain.com</a>
      checks if 12345678900 is a registered user in the system. <br>
      If not, the message header is translated to
      <a class="moz-txt-link-rfc2396E" href="mailto:sip:12345678900@gatewaydomain..com">"sip:12345678900@gatewaydomain..com"</a> and forwarded.<br>
      Incoming messages need to be accepted from their IP as well.<br>
      <br>
      It would also be useful if the address came as "<a
        moz-do-not-send="true"
        href="mailto:sip%3A2345678900@mydomain.com">sip:2345678900@mydomain.com</a>"
      could be translated to "sip:<u>1</u><a moz-do-not-send="true"
        href="mailto:2345678900@gatewaydomain.com">2345678900@gatewaydomain.com</a>".<br>
      <br>
      <br>
      Is there any built in functionality I can configure for this, or
      will this need to be scripted?<br>
      <br>
      <br>
      Thanks,<br>
      Ed<br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>