Menu

loopback SIP routing

Help
church
2011-08-31
2013-05-28
  • church

    church - 2011-08-31

    xen-ised CentOS 5.6 / t38modem 2.0.0 (with opal/ptlib from sources that came with it's release) / hylafax+-5.5. No iaxmodems/asterisk.

    I solved problem of unable to allocate many numbers with single t38modem instance by increasing prior launch as needed max open FDs with increasing soft and hard limits by ulimit -Sn #### & ulimit -Hn #### (sys wide /proc/sys/fs/file-max was way bigger then anyone might hit). (Seems that by increasing limits one should be able to allocate even hundreds of numbers. I scripted launchscript to increase limits according to pty count (for each aprox. 9-11 extra FDs needed, and one might check how much needed with lsof -p $(pgrep t38modem)|wc -l).

    I'm able to send and recieve faxes to several fax numbers, with one caveat - if numbers i'm sending to/recieving from are not among my allocated ones. Then it just routes:
    from sip:faxnumber@siplistenIP to sip:faxnumber@siplistenIP, route to sip:faxnumber@siplistenIP
    tries out one by one big range of ports (until failing when hitting max FD limit), then it core dumps with
    Assertion fail: Operating System error, file ptlib/unix/tlibthrd.cxx, line 1108, Error=9.
    Then sending fax reports busy line.
    Probably anyone can replicate by allocating two numbers with same instance and trying to send from one of them to another.

    I tried to separate into two t38modem instances, one for send only modems, another for recieve only ones
    (RingsBeforeAnswer: 0 and ModemReadyState: D in config), and even in case if sending number is not same as recieving one, still same wierd sip routing problems with "from,to,route" showing same number/same IP.

    Oh, and I also was unable to use send only modems with -sip-no-listen directive, i needed to put something for them to work, eg. -sip-listen udp\$localhost (other variants with different then real listen ip or tcp\$ didn't work). Is -sip-nolisten option working as it intended (as imho that shouldn't be the option to disable sip protocol in general, for which there already is -no-sip one)? It seemed to me that for sending only -route "modem:.*=sip:<dn>sipgwIP" should be enough and no local listening should be required?

    Well, anyway, back to problem of inability to loopback sip send/fax. I really hope to avoid to script up replacement for sendfax that checks if number is not among local ones and then checks file type / converts and mails directly by itself instead of sending fax. Can someone hint how to loopback send faxes with current t38modem version or can point me to some ready workarounds/scripts that i might adapt/reuse? Or maybe there is something that can be patched in t38modem source (unfortunately have no coding skills/knowledge myself)?

     
  • Vyacheslav Frolov

    See  t38modem-Feature Requests-3401251

     
  • church

    church - 2011-08-31

    Thanks for prompt reply.

    But if SIP GW configuration side is out of my hands then there is only so much i can do. I might try convince those guys to configure some lesser fax number per port, eg. 50, but am rather doubtful to see each number per own individual port. Imho it should be usuable/doable, as commercial alternative in windows server is using such configuration just fine, and hundreds of numbers doesn't mean that they all are sending/recieving faxes simultaneously. Also problem with loopback sip routing was there even with just two testnumbers.

    Gonna try out mentioned hints in feature requests configuration/testing. Hopefully it will help with loopback sip routing without receiving t38modem coredumping. Something from it like AT#CID=10 i already used before, by uncommenting few lines with ModemResetCmds/RingsBeforeAnswer/CallIDPattern to get CallID reporting out of sip gw, so that i can dispatch recieved faxes according to them instead of modem tty names.

    Can you hint me, how that ATI9 and others should be used in actual modem configuration instead of entering by hand? Unfortunately my knowledge of hylafax (and telephony in general) is rather lacking, so i am not too sure which configuration variable should contain those commands.

     
  • church

    church - 2011-09-18

    To make long story short, i solved loopback faxing by separating send and receive modems in two instances -sip-listening to separate IP addresses (ifconfig-ed ip alias) and adding another IP to pool guys managing sip gateway. Now i can send/recieve both to/from outside and among my fax number pool including if to/from is same number.
    Pros: it works :) even without separate t38modem instances per each individual number on different ports (in my case for now ~90 numbers with one instance).
    Cons: need for 2nd IP, problematic if it's extra paid for service or if such configuration is not offered by SIP provider and cannot be agreed upon.
    Would be nice to see in future t38modem to not choke and mess up with sip routing, if originating numbers/calls are among local ones without extra hacks, when multi-number SIP is provided through single port like for me.

    t38modem --no-h323 --sip-audio *ALaw* --fake-audio G.729* \
      --sip-t38-udptl-redundancy 2:I,9:L,32767:H --sip-listen udp\$first_sip_ip:5060 \
      --route sip:.*=modem:<dn> --pts-dir /dev/ -p +ttyT38r1,+ttyT38r2...
    t38modem --force-fax-mode --no-force-t38-mode --no-h323 --sip-audio *ALaw* \
      --fake-audio G.729* --sip-t38-udptl-redundancy 2:I,9:L,32767:H \
      --sip-listen udp\$second_sip_ip:5060 --route "modem:.*=sip:<dn>@sip_gateway_ip:5060" \
      --pts-dir /dev/ -p +ttyT38s1,+ttyT38s2...
    

    P.S.
    With many numbers one shouldn't forget increasing max file handle limits prior launching t38modems with ulimit -Hn ### and ulimit -Sn ###. ~ 73 each instance + 9 for each allocated tty +8 for each call (+i add some 20 for any case). After call +8 drops to 6 less, +2.
    For ten numbers receive modems and three send modems with three max simultaneous calls it would be:
    73*2 + (9+2)*10 + (9+2)*3 + 3*6 + 20 = 327.
    At least here on centos5 default hard and soft limit is 1024, so one may need to increase them when having 60-70 numbers, to not core dump with "Assertion fail: Operating System error, file ptlib/unix/tlibthrd.cxx, line 1108, Error=9".

     

Log in to post a comment.