Advertisement
Guest User

Untitled

a guest
May 30th, 2015
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. NUM="$1"
  4. uri=""
  5.  
  6. num2name() {
  7. l=${#NUM}
  8. i=$l
  9. while [ $i -gt 0 ]; do
  10. n="$( echo "$NUM" | cut -b ${i} )"
  11. echo -n "$n."
  12. i=$(( $i - 1 ))
  13. done
  14. echo "e164.p2p"
  15. }
  16.  
  17. qs="$( num2name "$1" )"
  18.  
  19. kadnode-ctl lookup $qs 2>/dev/null | while read res; do
  20. ip="$( echo $res | cut -d':' -f1 )"
  21. port="$( echo $res | cut -d':' -f2 )"
  22. proto=""
  23. case "$port" in
  24. 5060)
  25. proto=""
  26. ;;
  27. 5061)
  28. proto=";proto=tls"
  29. ;;
  30. esac
  31. [ "$m" ] && echo -n "&"
  32. echo -n "SIP/${1}@$ip$proto"
  33. m=1
  34. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement