Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def freeswitch
- if (!params[:sip_auth_username].nil? && !params[:sip_auth_username].match(/wp_(.*)/).nil?)
- 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>'
- render :text =>fs_xml
- elsif (!params[:sip_auth_username].nil? && !params[:sip_auth_username].match(/sip_(.*)/).nil?)
- user_id = params[:sip_auth_username].match(/sip_(.*)/)[1]
- user = User.find(user_id)
- 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>'
- render :text =>fs_xml
- else
- # not a wp_
- render :text =>'<document type="freeswitch/xml"><section name="result"><result status="not found" /></section></document>'
- end
- end
Add Comment
Please, Sign In to add comment