Closed GoogleCodeExporter closed 9 years ago
I forgot to note that the URL that is having the issue is:
http://freeswitch.abc.com/app/registrations/v_status_registrations.php?show_reg=
1&profile=internal
Original comment by gilbert....@gmail.com
on 29 Aug 2012 at 12:13
I added the following code after line 72 of v_status_registrations.php to
temporarily fix my issue...
$xml_response = str_replace("Patton Smartlink 4020 <3.01.002 20 EN n0
(1214)><00a0ba017198>", "Patton Smartlink 4020", $xml_response);
Unfortunately, I am not a PHP developer and do not know how to manipulate the
string in xml_response for other possible agents that may have '<' or '>'
without ruining the xml. I am quick enough though to do the basic modification
I made. If someone would like to help me, I would be happy to work with them
and knock this out.
Original comment by gilbert....@gmail.com
on 29 Aug 2012 at 11:01
^ is a carrot.
< is a less than sign.
> is a greater than sign.
To show the symbols correctly I added 'htmlentities'
echo " <td
class='".$row_style[$c]."'> ".htmlentities($row['agent'])." </td>\n";
Please test to confirm this is fixed.
Original comment by markjcrane@gmail.com
on 30 Aug 2012 at 12:42
Sorry about the delayed response. I understand that I made a mistake in my
statement by labeling it carrot.
I tried adding your supplied line and it still failed with the same error (I
replaced line 165).
If I replace line 165 with the line below it still throws the error (ie. the
error is above the line modified)
echo " <td></td>\n";
I believe that it is failing at line 74.
$xml = new SimpleXMLElement($xml_response);
I think SimpleXMLElement is interpreting the information bracketed by the <> as
xml tags. Since there are no identical tags with leading forward slashes, it is
having issues. This is conjecture and I am not sure 100%.
Original comment by gilbert....@gmail.com
on 31 Aug 2012 at 6:13
This is a FreeSWITCH bug. A request is made to get the registration info as
XML. FreeSWITCH should escape the special characters the < and > and that is
not being done.
There are two commands in FreeSWITCH that can get registration information.
show registrations as xml
Try this one and report back if the characters still show up as < and > in the
agent string or if they are escaped.
Original comment by markjcrane@gmail.com
on 31 Aug 2012 at 6:28
Here is my solution... It is a little dirty since I am not a coder... I
inserted this after line 72, "$xml_response = str_replace("</profile-info>",
"</profile_info>", $xml_response);"
// Initialize variables to clean agent string
$agentstring0 = $xml_response;
$agentstring1 = '';
$xml_response = '';
// Find first position of the word <agent>
$y = strpos($agentstring0, '<agent>');
// Run loop until the word <agent> is no longer found
while( $y != 0 ) {
// Increment position by 7, the length of the word <agent>
$y = $y + 7;
// Capture everthing following the word <agent> and store it in $agentstring1
$agentstring1 = substr($agentstring0, $y);
// Add all text prior to the word <agent> to the xml_response
$xml_response = $xml_response . substr($agentstring0, 0, $y);
// Find the position of the word </agent>
$y = strpos($agentstring1, '</agent>');
if ( $y != 0 ) {
// Capture everthing following the word </agent> and store it in $agentstring0
$agentstring0 = substr($agentstring1, $y);
// Cleanup text between agent tags and add it to the xml_response
$xml_response = $xml_response . htmlentities(substr($agentstring1, 0, $y));
// Find the next occurance of the word <agent>
$y = strpos($agentstring0, '<agent>');
// If the last agent tag was found, append everything that followed </agent> to the xml_response
if ( $y == 0 ) {
$xml_response = $xml_response . $agentstring0;
}
}
else {
// Error, there is no closing XML tag
exit;
}
}
Original comment by gilbert....@gmail.com
on 31 Aug 2012 at 10:37
The comment "// Capture everthing following the word </agent> and store it in
$agentstring0" should read "// Capture everthing following and including the
word </agent> and store it in $agentstring0"
Original comment by gilbert....@gmail.com
on 31 Aug 2012 at 10:39
Also, I believe my patch requires php 5.3+.
Original comment by gilbert....@gmail.com
on 31 Aug 2012 at 10:41
Mark,
You are correct that it is not encoding the characters properly. Running "sofia
xmlstatus profile internal reg" returns the following for the agent in
question...
<agent>Patton Smartlink 4020 <3.01.002 20 EN n0 (1214)><00a0ba017198></agent>
and not returning < or >. My code above though fixes that but will probably
break things if Freeswitch changes their behavior.
Original comment by gilbert....@gmail.com
on 1 Sep 2012 at 12:04
The appropriate place to fix this is in FreeSWITCH. Please report this to
FreeSWITCH dev team by adding a JIRA ticket.
Original comment by markjcrane@gmail.com
on 3 Sep 2012 at 9:35
This has been fixed by freeswitch.
http://jira.freeswitch.org/browse/FS-3971
I have tested the freeswitch patch as well as tested the latest git and the
issue is resolved.
output from "sofia xmlstatus profile internal reg" now returns the following:
<agent>Patton Smartlink 4020 <3.01.002 20 EN n0 (1214)><00a0ba017198></agent>
Original comment by gilbert....@gmail.com
on 4 Sep 2012 at 6:14
Thanks for reporting the issue to FreeSWITCH and then reporting back that it is
fixed.
Original comment by markjcrane@gmail.com
on 7 Sep 2012 at 6:18
Original issue reported on code.google.com by
gilbert....@gmail.com
on 29 Aug 2012 at 12:11