|
From: <si...@us...> - 2006-03-10 10:35:57
|
Revision: 560 Author: sickpig Date: 2006-03-10 02:35:50 -0800 (Fri, 10 Mar 2006) ViewCVS: http://svn.sourceforge.net/yaacs/?rev=560&view=rev Log Message: ----------- * yavoip: add function to set what type of audio codec to use * yacati: add a very simple status bar for VoIP call (for a more clever one we have to resolve the thread problem between tcliaxc and yacati) Modified Paths: -------------- trunk/yaacs/yavoip.tcl trunk/yacati.tcl Modified: trunk/yaacs/yavoip.tcl =================================================================== --- trunk/yaacs/yavoip.tcl 2006-03-09 18:29:25 UTC (rev 559) +++ trunk/yaacs/yavoip.tcl 2006-03-10 10:35:50 UTC (rev 560) @@ -116,8 +116,9 @@ ::yalog::debug "callNo: $::yavoip::iaxcEvent(callNo)" ::yalog::debug "message: $::yavoip::iaxcEvent(message)" set ris $::yavoip::iaxcEvent(message) - if {($ris=="OCCUPATO")||($ris=="LIBERO")||($ris=="INESISTENTE")} { + if {($ris eq "OCCUPATO")||($ris eq "LIBERO")||($ris eq "INESISTENTE")} { ::yavoip::hangup + #there's a tkwait on yacati wating for thi change set ::yavoip::result $ris } elseif {$ris=="Call disconnected by remote"} { set yavoip::result "AGGANCIATO" @@ -171,7 +172,25 @@ if {[catch {::iaxc::iaxcRegister $::yavoip::prefs(user) $::yavoip::prefs(pass) $::yavoip::prefs(server)} errb]} { ::yalog::error "\[iaxc\] Registration to server failed with message: $errb " return -1 - } + } + + switch $::yavoip::prefs(preferred_codec) { + gsm {set codec [expr 1 << 1]} + ulaw {set codec [expr 1 << 2]} + alaw {set codec [expr 1 << 3]} + speex {set codec [expr 1 << 9]} + ilibc {set codec [expr 1 << 10]} + default { + ::yalog::error "Wrong codec name: $::yavoip::prefs(preferred_codec)" + ::yalog::error "Setting codec to gsm" + set codec [expr 1 << 1] + } + } + + if {[catch {::iaxc::iaxcAudioEncoding $codec} errb]} { + ::yalog::error "Unable to set the preferred codec" + } + } # Hangup the phone Modified: trunk/yacati.tcl =================================================================== --- trunk/yacati.tcl 2006-03-09 18:29:25 UTC (rev 559) +++ trunk/yacati.tcl 2006-03-10 10:35:50 UTC (rev 560) @@ -347,14 +347,13 @@ ## #Grid 8 labelframe .g8 -relief flat -entry .g8.estatus -relief groove -state disabled +entry .g8.estatus -relief groove -state normal -disabledforeground black -justify center scale .g8.svolume -showvalue 0 -label [mc "Volume"] -from 0 -to 100 -width 10 -orient horizontal \ -variable ::yacati::volume -command {::snack::audio play_gain } #label .g8.lbvol -text 0 grid columnconfigure .g8 0 -weight 1 -#grid .g8.estatus .g8.svolume .g8.lbvol -sticky news grid .g8.estatus .g8.svolume -sticky news #add grid 8 to root window @@ -397,6 +396,7 @@ wm deiconify . update + ################################################################################ # Widget manipulation functions # @@ -503,7 +503,7 @@ #group 8 "voip_status" { set obj ".g8.estatus"} - "volume" { set obj ".g8.lbvol" } + "volume" { set obj ".g8.svolume" } default { ::yalog::error "Widget doesen't exist: $name"; exit } } @@ -645,6 +645,8 @@ ::yalog::debug "Button hangup pressed..." ::yavoip::hangup set yacati::call 2 + + ::yacati::setWdjValue voip_status "" disabled ::yacati::setWdjText bt_new [mc "Recall"] normal ::yacati::configureWdj bt_save state normal ::yacati::configureWdj bt_finish state normal @@ -1576,9 +1578,6 @@ yacati::configureWdj tel1 state normal yacati::configureWdj tel2 state normal - #yacati::configureWdj tel1 disabledbackground $::yacati::df - #yacati::configureWdj tel2 disabledbackground $::yacati::df - yacati::setWdjValue tel1 "" disabled yacati::setWdjValue tel2 "" disabled yacati::setWdjValue tel3 "" disabled @@ -1616,7 +1615,9 @@ yacati::clearCombo work yacati::clearCombo study yacati::clearCombo birthday - + if {$::yacati::autodial == 1} { + ::yacati::setWdjValue voip_status "" disabled + } if {$yacati::survey(azienda)=="t"} {::yacati::incWdjState disabled} else {::yacati::popWdjState disabled} set yacati::call 0 yacati::setWdjText bt_new [mc "New contact"] normal @@ -2439,12 +2440,13 @@ array set survey [array get yacati::survey] [::yacati::getWdj con_state] configure -state normal yacati::clearCombo con_state - + set listres [split $callres -] + set callres [string trim [lindex $listres 0]] switch $callres { - "LIBERO" { [::yacati::getWdj con_state] insert entry 0 [lindex $survey(statox) 2] } - "OCCUPATO" { [::yacati::getWdj con_state] insert entry 0 [lindex $survey(statox) 1] } - "INESISTENTE" { [::yacati::getWdj con_state] insert entry 0 [lindex $survey(statox) 5] } - "AGGANCIATO" { [::yacati::getWdj con_state] delete entry 0 end } + "LIBERO" { [::yacati::getWdj con_state] insert entry 0 [lindex $survey(statox) 2]} + "OCCUPATO" { [::yacati::getWdj con_state] insert entry 0 [lindex $survey(statox) 1]} + "INESISTENTE" { [::yacati::getWdj con_state] insert entry 0 [lindex $survey(statox) 5]} + "AGGANCIATO" { [::yacati::getWdj con_state] delete entry 0 end} "SALVATO" { set yavoip::result ""; return } "-2" { yatk_dlg::error [mc "Call the administrator, there is a problem with VoIP connections"] @@ -2453,6 +2455,7 @@ } } set yacati::call 2 + ::yacati::setWdjValue voip_status "" disabled yacati::setWdjText bt_new [mc "Recall"] normal yacati::configureWdj bt_save state normal yacati::configureWdj bt_finish state normal @@ -2475,13 +2478,18 @@ set ::yacati::call 2 ::yatk_dlg::error [mc "Error while calling selected phone number..."] } else { + + set telnumber [::yacati::get_phone_number [::yacati::get_active_phone]] + set status [mc "you're calling phone [::yacati::get_active_phone], number $telnumber ..."] + ::yacati::setWdjValue voip_status $status disabled + set ::yacati::call 1 yacati::configureWdj bt_save state disabled yacati::setWdjText bt_new [mc "Hangup"] normal yacati::configureWdj bt_finish state disabled yacati::configureWdj con_state state disabled tkwait variable ::yavoip::result - + #after that yavoip::result is modified we check if #the contact is saved trough invia email/fax/appuntamento if {$yavoip::result=="SALVATO" && ($yacati::autodial==1)} { @@ -2494,6 +2502,7 @@ } } + # Read flux that coming from pipe, it's used # to comunicate with yacati::config(CATI_EXE) # application. It simply wait for an EOF from This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |