<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Send events to connected users from FOP2Callbacks.pm]]></title><description><![CDATA[<p dir="auto">Hello.</p>
<p dir="auto">I'm trying to make FOP2 chrome app to open URL upon answering any call (not just queue calls) with <a href="http://FOP2Callbacks.pm" rel="nofollow ugc">FOP2Callbacks.pm</a>. I see that <a href="http://FOP2Callbacks.pm" rel="nofollow ugc">FOP2Callbacks.pm</a> is mostly aimed at executing AMI actions, is it possible to send events to connected users from <a href="http://FOP2Callbacks.pm" rel="nofollow ugc">FOP2Callbacks.pm</a>?<br />
What I'm aiming for is making fop2_server to send notification to client on receiving the BridgeEnter event (like it does on receiving the AgentConnect event).</p>
]]></description><link>https://forum.fop2.com/topic/1981/send-events-to-connected-users-from-fop2callbacks.pm</link><generator>RSS for Node</generator><lastBuildDate>Tue, 27 Oct 2026 22:49:08 GMT</lastBuildDate><atom:link href="https://forum.fop2.com/topic/1981.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 11 May 2015 18:55:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Send events to connected users from FOP2Callbacks.pm on Thu, 14 May 2015 23:39:46 GMT]]></title><description><![CDATA[<p dir="auto">Thank you again. Works great now.</p>
]]></description><link>https://forum.fop2.com/post/8651</link><guid isPermaLink="true">https://forum.fop2.com/post/8651</guid><dc:creator><![CDATA[toxa]]></dc:creator><pubDate>Thu, 14 May 2015 23:39:46 GMT</pubDate></item><item><title><![CDATA[Reply to Send events to connected users from FOP2Callbacks.pm on Wed, 13 May 2015 16:29:45 GMT]]></title><description><![CDATA[<p dir="auto">You might need to configure the asterisk manager (manager.conf) to publish the variables you are interested in, something like:</p>
<pre><code>channelvars=UNIQUEID,SOMETHINGELSE
</code></pre>
]]></description><link>https://forum.fop2.com/post/8650</link><guid isPermaLink="true">https://forum.fop2.com/post/8650</guid><dc:creator><![CDATA[nicolas]]></dc:creator><pubDate>Wed, 13 May 2015 16:29:45 GMT</pubDate></item><item><title><![CDATA[Reply to Send events to connected users from FOP2Callbacks.pm on Tue, 12 May 2015 22:43:27 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for your help, I got it to work with <a href="http://FOP2Callbacks.pm" rel="nofollow ugc">FOP2Callbacks.pm</a> (didn't manage to send any events from plugin).<br />
I have some problems with substitutions in the popup link though. Only #{CLIDNUM} and #{CLIDNAME} work, both #{UNIQUEID} and #{EXTEN} substitute undefined.</p>
<p dir="auto">WIP code for Asterisk 13 and FOP2 2.29 (wasn't tested thoroughly):</p>
<pre><code>#. . .
sub __prep_chan {
	my $chan = shift(@_);
	
	$chan =~ s/^(.*)-.*/$1/;
	$chan = uc($chan);
	
	return $chan;
}

sub amiCommand {

	# Received an event from Asterisk Manager Interfase

	$command  = shift;

	if($command eq "DIALEND") {
		%event = @_;
		if($event{'DialStatus'} eq 'ANSWER') {
			my $dst_chan = __prep_chan($event{'DestChannel'});
			my $src_chan = __prep_chan($event{'Channel'});
			my $uid = $event{'Uniqueid'};
			
			my $return = "";
			my @allreturn = ();
			
			$return = "Action: UserEvent\r\n";
			$return .= "UserEvent: CustomPopup\r\n";
			$return .= "Uniqueid: $uid\r\n";
			$return .= "Channel: $dst_chan\r\n";
			$return .= "Family: notifyconnect\r\n";
			$return .= "Value: $src_chan\r\n";
			$return .= "\r\n";
			
			push @allreturn, $return;
			return @allreturn;
		}
	}

#. . .
}
</code></pre>
]]></description><link>https://forum.fop2.com/post/8649</link><guid isPermaLink="true">https://forum.fop2.com/post/8649</guid><dc:creator><![CDATA[toxa]]></dc:creator><pubDate>Tue, 12 May 2015 22:43:27 GMT</pubDate></item><item><title><![CDATA[Reply to Send events to connected users from FOP2Callbacks.pm on Tue, 12 May 2015 12:59:23 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">My suggestion is to use the new plugin architecture to write such a modification. The .pl part of the plugin should contain something similar to this (that might vary depending on your Asterisk version, this sample is for Asterisk 11). You have to use a UserEvent to return a command to the client side (browser/extension), the command you want to send is the notifyconnect (or notifyringing). The event to intercept is "LINK" as fop2 will translate events to make it backwards compatible...</p>
<pre><code>$AMI_Event_Handler{'bridgepopup'}{'LINK'} = sub {
    my $event = shift;
    my @allreturn;

    my $state = ${$event}{'Bridgestate'};
    $canal  = FOP2::utils::get_channel(${$event}{Channel1});
    $canal2 = FOP2::utils::get_channel(${$event}{Channel2});

    if($state eq "Link") {

        $return  = "Action: UserEvent\r\n";
        $return .= "UserEvent: CustomPopup\r\n";
        $return .= "Channel: $canal\r\n";
        $return .= "Family: notifyconnect\r\n";
        $return .= "Value: $canal2\r\n";
        $return .= "\r\n";
        push @allreturn, $return;

    }

    return @allreturn;
};
</code></pre>
<p dir="auto">Look at the sampleplugin source to get an idea of how to use it. You install plugins using the FOP2 Manager.</p>
<p dir="auto"><a href="http://download.fop2.com/plugins/sampleplugin-1.0.0.tgz" rel="nofollow ugc">http://download.fop2.com/plugins/sampleplugin-1.0.0.tgz</a></p>
<p dir="auto">Best regards,</p>
]]></description><link>https://forum.fop2.com/post/8648</link><guid isPermaLink="true">https://forum.fop2.com/post/8648</guid><dc:creator><![CDATA[nicolas]]></dc:creator><pubDate>Tue, 12 May 2015 12:59:23 GMT</pubDate></item></channel></rss>