提交 3cb83d21 authored 作者: Brian Fertig's avatar Brian Fertig

PHP Goes Beta

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2646 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 1ce451ad
...@@ -10,7 +10,7 @@ PHPLDFLAGS = `$(PCFG) --ldflags` -lcrypt -lresolv -lm -ldl -lnsl -lxml2 -lz -lph ...@@ -10,7 +10,7 @@ PHPLDFLAGS = `$(PCFG) --ldflags` -lcrypt -lresolv -lm -ldl -lnsl -lxml2 -lz -lph
all: depends $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(PHPMOD).$(DYNAMIC_LIB_EXTEN) all: depends $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(PHPMOD).$(DYNAMIC_LIB_EXTEN)
depends: depends:
MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install php-5.1.6.tar.gz --prefix=$(PREFIX) --enable-embed=shared --enable-shared --with-pic --with-mysql --with-curl --enable-maintainer-zts --with-tsrm-pthreads MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install php-5.1.6.tar.gz --prefix=$(PREFIX) --enable-embed=shared --enable-shared --with-pic --with-mysql --with-curl --enable-maintainer-zts --with-tsrm-pthreads --enable-debug
%.o: %.c %.o: %.c
$(CC) $(LCFLAGS) $(CFLAGS) -c $< -o $@ $(CC) $(LCFLAGS) $(CFLAGS) -c $< -o $@
...@@ -45,3 +45,4 @@ install: ...@@ -45,3 +45,4 @@ install:
cp -f freeswitch.php $(PREFIX)/lib/php cp -f freeswitch.php $(PREFIX)/lib/php
cp -f apptest.php $(PREFIX)/scripts cp -f apptest.php $(PREFIX)/scripts
cp -f test.php $(PREFIX)/scripts cp -f test.php $(PREFIX)/scripts
cp -f php.ini $(PREFIX)/lib
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
* *
* Anthony Minessale II <anthmct@yahoo.com> * Anthony Minessale II <anthmct@yahoo.com>
* Brian Fertig <brian.fertig@convergencetek.com> * Brian Fertig <brian.fertig@convergencetek.com>
* Steph Fox <steph@zend.com>
*
* *
* mod_php.c -- PHP Module * mod_php.c -- PHP Module
* *
...@@ -233,7 +235,7 @@ static void php_function(switch_core_session_t *session, char *data) ...@@ -233,7 +235,7 @@ static void php_function(switch_core_session_t *session, char *data)
//ZEND_SET_SYMBOL(&EG(active_symbol_table), "session", php_session); //ZEND_SET_SYMBOL(&EG(active_symbol_table), "session", php_session);
// Force Some INI entries weather the user likes it or not // Force Some INI entries weather the user likes it or not
zend_alter_ini_entry("register_globals",sizeof("register_globals"),"1", sizeof("1") - 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); //zend_alter_ini_entry("register_globals", strlen("register_globals")+1, "1", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME);
// Execute the bloody script // Execute the bloody script
retval = php_execute_script(&script TSRMLS_CC); retval = php_execute_script(&script TSRMLS_CC);
......
差异被折叠。
...@@ -112,57 +112,38 @@ switch_core_session_t *fs_core_session_locate(char *uuid) ...@@ -112,57 +112,38 @@ switch_core_session_t *fs_core_session_locate(char *uuid)
return session; return session;
} }
void fs_channel_answer(char *uuid) void fs_channel_answer(switch_core_session_t *session)
{ {
switch_core_session_t *session; switch_channel_t *channel = switch_core_session_get_channel(session);
session = fs_core_session_locate(uuid);
switch_channel_t *channel;
channel = switch_core_session_get_channel(session);
switch_channel_answer(channel); switch_channel_answer(channel);
} }
void fs_channel_pre_answer(char *uuid) void fs_channel_pre_answer(switch_core_session_t *session)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_pre_answer(channel); switch_channel_pre_answer(channel);
} }
void fs_channel_hangup(char *uuid, char *cause) void fs_channel_hangup(switch_core_session_t *session, char *cause)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_hangup(channel, switch_channel_str2cause(cause)); switch_channel_hangup(channel, switch_channel_str2cause(cause));
} }
void fs_channel_set_variable(char *uuid, char *var, char *val) void fs_channel_set_variable(switch_core_session_t *session, char *var, char *val)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_set_variable(channel, var, val); switch_channel_set_variable(channel, var, val);
} }
void fs_channel_get_variable(char *uuid, char *var) void fs_channel_get_variable(switch_core_session_t *session, char *var)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_get_variable(channel, var); switch_channel_get_variable(channel, var);
} }
void fs_channel_set_state(char *uuid, char *state) void fs_channel_set_state(switch_core_session_t *session, char *state)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_state_t fs_state = switch_channel_get_state(channel); switch_channel_state_t fs_state = switch_channel_get_state(channel);
...@@ -176,16 +157,13 @@ void fs_channel_set_state(char *uuid, char *state) ...@@ -176,16 +157,13 @@ void fs_channel_set_state(char *uuid, char *state)
IVR Routines! You can do IVR in PHP NOW! IVR Routines! You can do IVR in PHP NOW!
*/ */
int fs_ivr_play_file(char *uuid, int fs_ivr_play_file(switch_core_session_t *session,
char *file, char *file,
char *timer_name, char *timer_name,
switch_input_callback_function_t dtmf_callback, switch_input_callback_function_t dtmf_callback,
void *buf, void *buf,
unsigned int buflen) unsigned int buflen)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
if (switch_strlen_zero(timer_name)) { if (switch_strlen_zero(timer_name)) {
timer_name = NULL; timer_name = NULL;
...@@ -195,40 +173,31 @@ int fs_ivr_play_file(char *uuid, ...@@ -195,40 +173,31 @@ int fs_ivr_play_file(char *uuid,
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
int fs_switch_ivr_record_file(char *uuid, int fs_switch_ivr_record_file(switch_core_session_t *session,
switch_file_handle_t *fh, switch_file_handle_t *fh,
char *file, char *file,
switch_input_callback_function_t dtmf_callback, switch_input_callback_function_t dtmf_callback,
void *buf, void *buf,
unsigned int buflen) unsigned int buflen)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
status = switch_ivr_record_file(session, fh, file, dtmf_callback, buf, buflen); status = switch_ivr_record_file(session, fh, file, dtmf_callback, buf, buflen);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
int fs_switch_ivr_sleep(char *uuid, int fs_switch_ivr_sleep(switch_core_session_t *session,
uint32_t ms) uint32_t ms)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
status = switch_ivr_sleep(session, ms); status = switch_ivr_sleep(session, ms);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
int fs_ivr_play_file2(char *uuid, int fs_ivr_play_file2(switch_core_session_t *session,
char *file) char *file)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
status = switch_ivr_play_file(session, NULL, file, NULL, NULL, NULL, 0); status = switch_ivr_play_file(session, NULL, file, NULL, NULL, NULL, 0);
...@@ -236,21 +205,18 @@ int fs_ivr_play_file2(char *uuid, ...@@ -236,21 +205,18 @@ int fs_ivr_play_file2(char *uuid,
} }
int fs_switch_ivr_collect_digits_callback (char *uuid, int fs_switch_ivr_collect_digits_callback (switch_core_session_t *session,
switch_input_callback_function_t dtmf_callback, switch_input_callback_function_t dtmf_callback,
void *buf, void *buf,
unsigned int buflen) unsigned int buflen)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
status = switch_ivr_collect_digits_callback(session, dtmf_callback, buf, buflen); status = switch_ivr_collect_digits_callback(session, dtmf_callback, buf, buflen);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
int fs_switch_ivr_collect_digits_count(char *uuid, int fs_switch_ivr_collect_digits_count (switch_core_session_t *session,
char *buf, char *buf,
unsigned int buflen, unsigned int buflen,
unsigned int maxdigits, unsigned int maxdigits,
...@@ -258,9 +224,6 @@ int fs_switch_ivr_collect_digits_count(char *uuid, ...@@ -258,9 +224,6 @@ int fs_switch_ivr_collect_digits_count(char *uuid,
char *terminator, char *terminator,
unsigned int timeout) unsigned int timeout)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
status = switch_ivr_collect_digits_count(session, buf, buflen, maxdigits, terminators, terminator, timeout); status = switch_ivr_collect_digits_count(session, buf, buflen, maxdigits, terminators, terminator, timeout);
...@@ -280,7 +243,7 @@ int fs_switch_ivr_collect_digits_count(char *uuid, ...@@ -280,7 +243,7 @@ int fs_switch_ivr_collect_digits_count(char *uuid,
} }
*/ */
int fs_switch_ivr_originate(char *uuid, int fs_switch_ivr_originate (switch_core_session_t *session,
switch_core_session_t **bleg, switch_core_session_t **bleg,
char * bridgeto, char * bridgeto,
uint32_t timelimit_sec) uint32_t timelimit_sec)
...@@ -289,8 +252,6 @@ int fs_switch_ivr_originate(char *uuid, ...@@ -289,8 +252,6 @@ int fs_switch_ivr_originate(char *uuid,
char * cid_num_override, char * cid_num_override,
switch_caller_profile_t *caller_profile_override) */ switch_caller_profile_t *caller_profile_override) */
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_channel_t *caller_channel; switch_channel_t *caller_channel;
switch_core_session_t *peer_session; switch_core_session_t *peer_session;
...@@ -315,21 +276,18 @@ int fs_switch_ivr_originate(char *uuid, ...@@ -315,21 +276,18 @@ int fs_switch_ivr_originate(char *uuid,
} }
int fs_switch_ivr_session_transfer(char *uuid, int fs_switch_ivr_session_transfer(switch_core_session_t *session,
char *extension, char *extension,
char *dialplan, char *dialplan,
char *context) char *context)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
status = switch_ivr_session_transfer(session,extension,dialplan,context); status = switch_ivr_session_transfer(session,extension,dialplan,context);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
int fs_switch_ivr_speak_text (char *uuid, int fs_switch_ivr_speak_text (switch_core_session_t *session,
char *tts_name, char *tts_name,
char *voice_name, char *voice_name,
char *timer_name, char *timer_name,
...@@ -339,9 +297,6 @@ int fs_switch_ivr_speak_text (char *uuid, ...@@ -339,9 +297,6 @@ int fs_switch_ivr_speak_text (char *uuid,
void *buf, void *buf,
unsigned int buflen) unsigned int buflen)
{ {
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
status = switch_ivr_speak_text(session,tts_name,voice_name,timer_name,rate,dtmf_callback,text,buf,buflen); status = switch_ivr_speak_text(session,tts_name,voice_name,timer_name,rate,dtmf_callback,text,buf,buflen);
...@@ -355,28 +310,17 @@ int fs_switch_ivr_speak_text (char *uuid, ...@@ -355,28 +310,17 @@ int fs_switch_ivr_speak_text (char *uuid,
*/ */
char* fs_switch_channel_get_variable(char *uuid, char *varname) char* fs_switch_channel_get_variable(switch_channel_t *channel, char *varname)
{ {
switch_channel_t *channel;
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
channel = switch_core_session_get_channel(session);
return switch_channel_get_variable(channel, varname); return switch_channel_get_variable(channel, varname);
} }
int fs_switch_channel_set_variable(char *uuid, char *varname, char *value) int fs_switch_channel_set_variable(switch_channel_t *channel, char *varname, char *value)
{ {
switch_channel_t *channel;
switch_core_session_t *session;
session = fs_core_session_locate(uuid);
switch_status_t status; switch_status_t status;
channel = switch_core_session_get_channel(session);
status = switch_channel_set_variable(channel, varname, value); status = switch_channel_set_variable(channel, varname, value);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
//char*
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论