Guest User

Untitled

a guest
Jan 18th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 1.02 KB | None | 0 0
  1.   def freeswitch
  2.     if (!params[:sip_auth_username].nil? && !params[:sip_auth_username].match(/wp_(.*)/).nil?)
  3.       fs_xml = '<document type="freeswitch/xml"><section name="directory"><domain name="'+DIALER_CONFIG['sip_ip']+'"><user id="wp_'+params[:sip_auth_username].match(/wp_(.*)/)[1]+'"><params></params></user></domain></section></document>'
  4.       render :text =>fs_xml
  5.     elsif (!params[:sip_auth_username].nil? && !params[:sip_auth_username].match(/sip_(.*)/).nil?)
  6.       user_id = params[:sip_auth_username].match(/sip_(.*)/)[1]
  7.       user = User.find(user_id)
  8.       fs_xml = '<document type="freeswitch/xml"><section name="directory"><domain name="'+DIALER_CONFIG['sip_ip']+'"><user id="sip_'+user_id.to_s+'"><params><param name="password" value="'+user.sip_password+'"/></params></user></domain></section></document>'
  9.       render :text =>fs_xml
  10.     else
  11.       # not a wp_
  12.       render :text =>'<document type="freeswitch/xml"><section name="result"><result status="not found" /></section></document>'
  13.     end
  14.   end
Add Comment
Please, Sign In to add comment