Hi, Vitalli,<br><br>Thanks for your PHP code. Unfortunately, I can't run that code because my project is in rails. <br>But I didnot see the difference between you code and mine. What does the xml log file look like when you turn on "xml_curl debug_on"? Could you cut and paste them into freeswitch pastebin? <br>
<br>My code is cloned from <a href="http://wiki.freeswitch.org/wiki/Mod_xml_curl_Ruby_directory_example" target="_blank">http://wiki.freeswitch.org/wiki/Mod_xml_curl_Ruby_directory_example</a>. I am not sure that the xml output may cause some problem. <br>
<br>When I type "find_use_xml id 1018 192.168.1.31", the FS ignored the response from web server. Instead, it retrieve the info from the local directory.<br><br><a href="mailto:freeswitch@proxy1.voiceserver.com" target="_blank">freeswitch@proxy1.voiceserver.com</a>> find_user_xml id 1018 192.168.1.31<br>
2010-05-24 15:12:12.239449 [CONSOLE] mod_xml_curl.c:299 XML response is in /usr/local/freeswitch/<div id=":6k" class="ii gt">scripts803ca405-c463-4deb-8121-982e1251831a.tmp.xml<br>
API CALL [find_user_xml(id 1018 192.168.1.31)] output:<br><user id="1018"><br> <params><br> <param name="password" value="1234"></param> <<<<===== the server response with "1018", "1234" is the local default setting<br>
<br> <param name="vm-password" value="1018"></param><br>
<br> </params><br><br> <variables><br> <variable name="toll_allow" value="domestic,international,local"></variable><br><br> <variable name="accountcode" value="1018"></variable><br>
<br> <variable name="user_context" value="default"></variable><br><br> <variable name="effective_caller_id_name" value="Extension 1018"></variable><br>
<br> <variable name="effective_caller_id_number" value="1018"></variable><br><br> <variable name="outbound_caller_id_name" value="MyPBX"></variable><br>
<br> <variable name="outbound_caller_id_number" value="0000000000"></variable><br><br> <variable name="callgroup" value="techsupport"></variable><br>
<br> </variables><br><br> </user><br><br>Below is the rails code to output the xml response.<br></div>==============================================<br>========<br><br> def directory<br> <br> if params['user'].nil? || params['user'].empty?<br>
##if not looking for a user info, send 404 Not Found<br>
@out_xml = Output404NotFound()<br> else<br> @username = params['user'].to_s<br> puts "username = " + @username<br> @domain = params['domain'].to_s<br> puts params<br>
@dir=Directory.find_by_effective_caller_id_number(@username)<br> puts @dir<br> if @dir.nil? <br> @out_xml = Output404NotFound()<br> else <br> @out_xml = OutputXMLResponse()<br> end<br>
end<br> puts "reply for directory query: " + @out_xml + "\n" <br> end<br> <br>private <br> <br> def Output404NotFound<br> xml_text = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><br>
<document type=\"freeswitch/xml\"><br> <section name=\"result\"><br> <result status=\"not found\" /><br> </section><br>
</document> "<br> return xml_text<br> end<br> <br> def OutputXMLResponse<br> xml_text = <br> "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><br>
<document type=\"freeswitch/xml\"><br> <section name=\"directory\" description=\"User Directory\"><br> <domain name=\"#{@domain}\"> <br>
<params><br> <param name=\"dial-string\" value=\"{presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(${dialed_user}@${dialed_domain})}\"/><br>
</params><br> <br> <groups><br> <group name=\"default\"><br> <users><br>
<user id=\"#{@username}\"><br> <params><br> <param name=\"password\" value=\"" + @dir.password + "\"/><br>
</params><br> </user><br> </users><br> </group><br> </groups><br>
</domain><br> </section><br> </document> "<br> puts "reply for directory query: " + xml_text + "\n"<br> return xml_text<br> end<br>
<br> <br><br><div class="gmail_quote">On Mon, May 24, 2010 at 8:38 AM, Vitalii Colosov <span dir="ltr"><<a href="mailto:vetali100@gmail.com" target="_blank">vetali100@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Just to avoid any misunderstanding - this is to check all other things around freeswitch configuration.<div><br><div>If this will work, it will be very easy to add database lookup for the user trying to register:</div><div>
<br></div><div><br></div><div><div>$user = $_POST['user'];</div><div>$query="select password from your_users_table where user ='$user'";</div><div>$result=mysqli_query($db_connection, $query);</div>
<div><br></div><div>...get user and password from the result</div><div><br></div><div>And then use $user and $password variables instead of hard-coded "1018", "1018" in the code I provided.</div><div>
<br>
</div><div>Really hope this helps, it works for me.</div><div><br></div><div>Regards,</div><div>Vitalie</div><div><br></div><div><div></div><div><br><div class="gmail_quote">2010/5/24 Vitalii Colosov <span dir="ltr"><<a href="mailto:vetali100@gmail.com" target="_blank">vetali100@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Sorry there was an else related to the missing entry, i removed it.<div><br></div><div>Please try another one.<br>
<br>
<div class="gmail_quote">2010/5/24 Vitalii Colosov <span dir="ltr"><<a href="mailto:vetali100@gmail.com" target="_blank">vetali100@gmail.com</a>></span><div><div></div><div><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Please try to use my attached php script, if you can.<div><br></div><div>I changed it to fit your data (user 1018, pass: 1018), but I did not check for any syntax error (hope it does not have :-) ).</div>
<div><br></div><div>
Please reply back on result.</div><div><br></div><div>Regards,</div><div><br></div><div>Vitalie<div><div></div><div><br><br><div class="gmail_quote">2010/5/24 Erwin Davis <span dir="ltr"><<a href="mailto:davis.erwin@gmail.com" target="_blank">davis.erwin@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">yeah, my code replied with line 29-46. I donot know where the rest of html code was generated. <br>
<div><div></div><div>
<br><div class="gmail_quote">On Mon, May 24, 2010 at 10:34 AM, Milena <span dir="ltr"><<a href="mailto:testeador01@gmail.com" target="_blank">testeador01@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>Hello,</div>You're not meant to send a whole website full of html tags as a response.<div>
Just reply the part of the lines 29 - 46 on your pastebin and get rid of the rest.</div><div><br><br><div class="gmail_quote">
2010,</div><div class="gmail_quote">/5/24 Erwin Davis <span dir="ltr"><<a href="mailto:davis.erwin@gmail.com" target="_blank">davis.erwin@gmail.com</a>></span><div><div></div><div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi, I am stuck, My console log is in <a href="http://pastebin.freeswitch.org/13030" target="_blank">http://pastebin.freeswitch.org/13030</a> and my xml log is in <a href="http://pastebin.freeswitch.org/13029" target="_blank">http://pastebin.freeswitch.org/13029</a>. I guess that the problem should be pretty small but I just can not figure it out. -:( Thanks for your help.<br>
<br><div class="gmail_quote"><div><div></div><div>On Mon, May 24, 2010 at 8:12 AM, Vitalii Colosov <span dir="ltr"><<a href="mailto:vetali100@gmail.com" target="_blank">vetali100@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>
Hi Erwin,<div>Maybe you need to add the first line <?xml version="1.0" encoding="UTF-8" standalone="no"?></div><div><br></div><div>This is what I have and it works perfectly, tested right now:</div>
<div><br></div><div><div><?xml version="1.0" encoding="UTF-8" standalone="no"?></div><div><div><document type="freeswitch/xml"></div><div> <section name="directory"></div>
</div><div> <domain name="$${domain}"></div><div> <params></div><div> <param name="dial-string" value="{presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(${dialed_user}@${dialed_domain})}"/></div>
<div> </params></div><div><div> <groups></div><div> <group name="default"></div><div> <users></div></div><div> <user id="1000"></div>
<div> <params></div>
<div> <param name="a1-hash" value="somehashvalue"/></div><div> <param name="vm-a1-hash" value="somehashvalue"/></div><div> </params></div>
<div> <variables></div><div> <variable name="user_context" value="default"/></div><div> <variable name="accountcode" value="1000"/></div>
<div> </variables></div><div><div> </user></div><div> </users></div><div> </group></div><div> </groups></div><div> </domain></div>
<div> </section></div>
<div></document></div><div><br></div></div><div>Regards,</div><div>Vitalie</div></div>
<br></div></div><div>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></div></blockquote></div><br>
<br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div></div></div><br></div>
<br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>
</div></div><br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div></div></div><br></div>
</blockquote></div><br></div></div></div></div>
<br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>