From anthm@freeswitch.org Mon Apr 30 20:37:10 2007 From: Freeswitch SVN To: freeswitch-trunk@lists.freeswitch.org Subject: [Freeswitch-trunk] [commit] r5048 - freeswitch/trunk/src/mod/endpoints/mod_portaudio Date: Mon, 30 Apr 2007 20:37:10 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4366730051646275697==" --===============4366730051646275697== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Author: anthm Date: Mon Apr 30 20:37:10 2007 New Revision: 5048 Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c Log: add cool web form from mod_alsa to mod_portaudio Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c (origina= l) +++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c Mon Apr = 30 20:37:10 2007 @@ -1720,6 +1720,9 @@ switch_status_t status =3D SWITCH_STATUS_SUCCESS; pa_command_t func =3D NULL; int lead =3D 1, devval =3D 0; + char *wcmd =3D NULL, *action =3D NULL; + char cmd_buf[1024] =3D ""; + const char *usage_string =3D "USAGE:\n" "-------------------------------------------------------------------------= -------\n" "pa help\n" @@ -1736,9 +1739,51 @@ "pa outdev [#|\n" "pa ringdev [#|\n" "-----------------------------------= ---------------------------------------------\n"; =20 - if (switch_strlen_zero(cmd)) { - stream->write_function(stream, "%s", usage_string); - goto done; + + if (stream->event) { +#if 0 + switch_event_header_t *hp; + stream->write_function(stream, "
");
+		for (hp =3D stream->event->headers; hp; hp =3D hp->next) {
+			stream->write_function(stream, "[%s]=3D[%s]\n", hp->name, hp->value);
+		}
+		stream->write_function(stream, "
"); +#endif + + wcmd =3D switch_str_nil(switch_event_get_header(stream->event, "wcmd")); + action =3D switch_event_get_header(stream->event, "action"); + + if (action) { + if (strlen(action) =3D=3D 1) { + snprintf(cmd_buf, sizeof(cmd_buf), "dtmf %s", action); + cmd =3D cmd_buf; + } else if (!strcmp(action, "mute")) { + snprintf(cmd_buf, sizeof(cmd_buf), "flags off mouth"); + cmd =3D cmd_buf; + } else if (!strcmp(action, "unmute")) { + snprintf(cmd_buf, sizeof(cmd_buf), "flags on mouth"); + cmd =3D cmd_buf; + } else if (!strcmp(action, "switch")) { + snprintf(cmd_buf, sizeof(cmd_buf), "switch %s", wcmd); + cmd =3D cmd_buf; + } else if (!strcmp(action, "call")) { + snprintf(cmd_buf, sizeof(cmd_buf), "call %s", wcmd); + cmd =3D cmd_buf; + } else if (!strcmp(action, "hangup") || !strcmp(action, "list") || !strcm= p(action, "answer")) { + cmd =3D action; + } + } + + if (switch_strlen_zero(cmd)) { + goto done; + } + + } else { + + if (switch_strlen_zero(cmd)) { + stream->write_function(stream, "%s", usage_string); + goto done; + } } =20 if (!(mycmd =3D strdup(cmd))) { @@ -1821,6 +1866,41 @@ =20 done: =20 + if (stream->event) { + + stream->write_function(stream, + "

\n" + "

\n" + + " " + " " + " " + " " + " " + " " + "

" + "\n" + "" + "" + "\n" + + "" + "" + "\n" + + "" + "" + "\n" + =20 + "" + "" + "\n" + "
" + =20 + "

\n" + ); + } + switch_safe_free(mycmd); =20 return status; --===============4366730051646275697==--