-
Notifications
You must be signed in to change notification settings - Fork 70
whisper en monitoreo de campaña con un click #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hgmnetwork
wants to merge
6
commits into
IssabelFoundation:master
Choose a base branch
from
hgmnetwork:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
67509b9
Update index.php
hgmnetwork 8084858
Update informacion_campania.tpl
hgmnetwork 42f3bd6
Update javascript.js
hgmnetwork 016752f
Create escuchar_agente.php
hgmnetwork 9c25a99
Update escuchar_agente.php
hgmnetwork 6baae1f
Update escuchar_agente.php
hgmnetwork File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| <?php | ||
| include("/var/www/html/libs/misc.lib.php"); | ||
| include("/var/www/html/configs/default.conf.php"); | ||
| include("/var/www/html/libs/paloSantoACL.class.php"); | ||
| include_once("/var/www/html/libs/paloSantoDB.class.php"); | ||
| session_name("issabelSession"); | ||
| session_start(); | ||
| $pDB = new paloDB($arrConf["issabel_dsn"]["acl"]); | ||
| $pACL = new paloACL($pDB); | ||
|
|
||
| if(isset($_SESSION["issabel_user"])){ | ||
| $issabel_user = $_SESSION["issabel_user"]; | ||
| } else { | ||
| $issabel_user = ""; | ||
| echo " no eres usuario autorizado"; | ||
| exit; | ||
| } | ||
|
|
||
| $extension_verificada = $pACL->getUserExtension($issabel_user); | ||
| //usamos solo la primera extensión como la valida para escuchar aunque el usuario tenga varias extensiones segun ampliacion codigo hgmnetwork.com 20-01-2019 | ||
| $array_extensiones=explode(";",$extension_verificada); | ||
| $extension=$array_extensiones[0];//la primera por defecto | ||
| //echo " la extension verificada es $extension_escucha y el id de usuario de sesion es $issabel_user<br>"; | ||
| //a la extension le quitamos el SIP/ o AGENT/ y dejamos solo el numero | ||
| $extension=preg_replace("/(SIP\/|AGENT\/i)/","",$extension);//dejamos solo el numero | ||
| //echo "<hr> la extension del usuario es $array_extensiones[0] y la del usuario actual es ".$_GET['agente']." <hr>"; | ||
| //lo mismo con el agente | ||
| $agente =trim($_GET['agente']); | ||
| $agente=preg_replace("/(SIP\/|AGENT\/)/i","",$agente);//dejamos solo el numero | ||
|
|
||
| #permit=127.0.0.1/255.255.255.0,xxx.xxx.xxx.xxx ;(the ip address of the server this page is running on) | ||
| $strHost = "127.0.0.1"; | ||
|
|
||
| #specify the username you want to login with (these users are defined in /etc/asterisk/manager.conf) o en manager_custom.conf | ||
| #por defecto usamos el usuario de php que viene | ||
| $strUser = "phpconfig"; | ||
|
|
||
| #specify the password for the above user | ||
| $strSecret = "php[onfig"; | ||
|
|
||
| $oSocket = fsockopen($strHost, 5038, $errnum, $errdesc) or die("Connection to host failed libs/escuchar_agente.php"); | ||
|
|
||
| $from = $extension;//quien escucha | ||
| $to = $agente;//quien es escuchado el agente | ||
| fputs($oSocket, "Action: Login\r\n"); | ||
| fputs($oSocket, "UserName: $strUser\r\n"); | ||
| fputs($oSocket, "Secret: $strSecret\r\n\r\n"); | ||
| $wrets=fgets($oSocket,128); | ||
| fputs($oSocket, "Action: Originate\r\n" ); | ||
| fputs($oSocket, "CallerId: Whisper Agente: $agente\r\n"); | ||
| //fputs($oSocket, "Channel: SIP/".$from."\r\n" ); | ||
| fputs($oSocket, "Channel: local/".$from."\r\n" ); | ||
| fputs($oSocket, "Application: ChanSpy\r\n" ); | ||
| fputs($oSocket, "Data: SIP/".$to."\r\n\r\n" ); | ||
| $wrets=fgets($oSocket,128); | ||
| sleep(3); | ||
|
|
||
| fclose($oSocket); | ||
| echo "Realizando Whisper al Agente $agente y a la extensión $extension"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -534,4 +534,34 @@ function mostrar_mensaje_error(s) | |
| $('#issabel-callcenter-error-message').fadeOut(); | ||
| }, 5000); | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| function escuchar(agente,extension){ | ||
| //reemplazamos cualquier etiqueta dejando solo el texto del agente por ejemplo SIP/agente o A/agente Agent/agente SIP/5001 A/5001 | ||
| const regex = /(<([^>]+)>)/ig; | ||
| var agente = agente.replace(regex, ''); | ||
| //ahora quitamos el espacio inicial o cualquiera | ||
| var agente = agente.replace(' ', ''); | ||
|
|
||
| $.ajax({ | ||
| url: "/modules/campaign_monitoring/libs/escuchar_agente.php", | ||
| type: "get", //send it through get method | ||
| data: { | ||
| agente: agente, | ||
| extension: extension, | ||
| }, | ||
|
|
||
| success: function(response) { | ||
| //Do Something | ||
| console.log(response); | ||
| }, | ||
| error: function(xhr) { | ||
| //Do Something to handle error | ||
| console.log('error escuchar_agente.php'); | ||
| console.log(xhr); | ||
| alert("Se ha producido un error al intentar escuchar al adengte.") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no está bien escrita la palabra agente |
||
| } | ||
| }); | ||
|
|
||
|
|
||
| }; | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aquí hay un error
Debe borrarse el > antes de OnClick