forked from mirrors/linphone-iphone
Merge branch 'master' of git.linphone.org:linphone-private
This commit is contained in:
commit
1a6849c101
80 changed files with 5740 additions and 1459 deletions
455
.cproject
455
.cproject
|
|
@ -2,231 +2,232 @@
|
|||
<?fileVersion 4.0.0?>
|
||||
|
||||
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="0.2079208171">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.2079208171" moduleId="org.eclipse.cdt.core.settings" name="Default">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="linphone" buildProperties="" description="" id="0.2079208171" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
|
||||
<folderInfo id="0.2079208171." name="/" resourcePath="">
|
||||
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.2084203071" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
|
||||
<targetPlatform binaryParser="org.eclipse.cdt.core.MachO64;org.eclipse.cdt.core.ELF" id="org.eclipse.cdt.build.core.prefbase.toolchain.2084203071.81924294" name=""/>
|
||||
<builder id="org.eclipse.cdt.build.core.settings.default.builder.731584538" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1252970003" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.1371414073" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.306286573" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.391709798" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1702094818" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.754828354" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.585510934" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<scannerConfigBuildInfo instanceId="0.2079208171">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
||||
<buildTargets>
|
||||
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildTarget>all</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="install" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>install</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
</buildTargets>
|
||||
</storageModule>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="linphone.null.1149313048" name="linphone"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="0.2079208171">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.2079208171" moduleId="org.eclipse.cdt.core.settings" name="Default">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="linphone" buildProperties="" description="" id="0.2079208171" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
|
||||
<folderInfo id="0.2079208171." name="/" resourcePath="">
|
||||
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.2084203071" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
|
||||
<targetPlatform binaryParser="org.eclipse.cdt.core.MachO64;org.eclipse.cdt.core.ELF" id="org.eclipse.cdt.build.core.prefbase.toolchain.2084203071.81924294" name=""/>
|
||||
<builder id="org.eclipse.cdt.build.core.settings.default.builder.731584538" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1252970003" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.1371414073" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.306286573" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.391709798" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1702094818" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.754828354" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.585510934" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<scannerConfigBuildInfo instanceId="0.2079208171">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
||||
<buildTargets>
|
||||
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>all</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="install" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildTarget>install</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
</buildTargets>
|
||||
</storageModule>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="linphone.null.1149313048" name="linphone"/>
|
||||
</storageModule>
|
||||
</cproject>
|
||||
|
|
|
|||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -39,7 +39,6 @@ INSTALL
|
|||
Specfile
|
||||
.anjuta/
|
||||
.anjuta_sym_db.db
|
||||
coreapi/help/doxygen.dox
|
||||
gtk-glade/version_date.h
|
||||
share/linphone.desktop
|
||||
|
||||
|
|
|
|||
19
Makefile.am
19
Makefile.am
|
|
@ -3,13 +3,20 @@
|
|||
# let make re-run automake upon need
|
||||
ACLOCAL_AMFLAGS = -I m4 $(ACLOCAL_MACOS_FLAGS)
|
||||
|
||||
if EXTERNAL_ORTP
|
||||
ORTP_DIR =
|
||||
if EXTERNAL_MEDIASTREAMER
|
||||
MS2_DIR=
|
||||
else
|
||||
ORTP_DIR = oRTP
|
||||
MS2_DIR=mediastreamer2
|
||||
endif
|
||||
|
||||
SUBDIRS = m4 pixmaps po $(ORTP_DIR) mediastreamer2\
|
||||
if EXTERNAL_ORTP
|
||||
ORTP_DIR=
|
||||
else
|
||||
ORTP_DIR=oRTP
|
||||
endif
|
||||
|
||||
|
||||
SUBDIRS = m4 pixmaps po $(ORTP_DIR) $(MS2_DIR) \
|
||||
coreapi console gtk share scripts
|
||||
|
||||
|
||||
|
|
@ -42,6 +49,7 @@ SDK_EXCLUDED= \
|
|||
|
||||
|
||||
GTK_PREFIX=/usr
|
||||
GTK_THEME=Outcrop
|
||||
GTK_FILELIST=gtk+-2.18.5.filelist
|
||||
GTK_FILELIST_PATH=$(shell cd $(top_srcdir) && pwd)/$(GTK_FILELIST)
|
||||
LINPHONEDEPS_FILELIST=linphone-deps.filelist
|
||||
|
|
@ -113,7 +121,8 @@ gtk-cherrypick:
|
|||
cp $$file $(INSTALLDIR_WITH_PREFIX)/$$file ;\
|
||||
fi \
|
||||
done && \
|
||||
cp -rf share/themes $(INSTALLDIR_WITH_PREFIX)/share/.
|
||||
mkdir -p $(INSTALLDIR_WITH_PREFIX)/share/themes && \
|
||||
cp -rf share/themes/$(GTK_THEME) $(INSTALLDIR_WITH_PREFIX)/share/themes/.
|
||||
|
||||
zip:
|
||||
rm -f $(ZIPFILE)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,10 @@ LOCAL_CFLAGS += \
|
|||
-DLOG_DOMAIN=\"Linphone\"
|
||||
|
||||
LOCAL_CFLAGS += -DIN_LINPHONE
|
||||
#LOCAL_CFLAGS += -DVIDEO_ENABLED -DIN_LINPHONE
|
||||
|
||||
ifeq ($(LINPHONE_VIDEO),1)
|
||||
LOCAL_CFLAGS += -DVIDEO_ENABLED
|
||||
endif
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH) \
|
||||
|
|
@ -67,7 +70,7 @@ LOCAL_C_INCLUDES += \
|
|||
$(LOCAL_PATH)/../../externals/exosip/include \
|
||||
$(LOCAL_PATH)/../../externals/osip/include
|
||||
|
||||
LOCAL_LDLIBS += -llog
|
||||
LOCAL_LDLIBS += -llog -ldl
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := \
|
||||
libmediastreamer2 \
|
||||
|
|
@ -76,6 +79,15 @@ LOCAL_STATIC_LIBRARIES := \
|
|||
libeXosip2 \
|
||||
libosip2 \
|
||||
libgsm
|
||||
|
||||
ifeq ($(LINPHONE_VIDEO),1)
|
||||
LOCAL_STATIC_LIBRARIES += \
|
||||
libavcodec \
|
||||
libswscale \
|
||||
libavcore \
|
||||
libavutil
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
LOCAL_CFLAGS += -DHAVE_ILBC=1
|
||||
LOCAL_STATIC_LIBRARIES += libmsilbc
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_INIT([linphone],[3.3.99.2],[linphone-developers@nongnu.org])
|
||||
AC_INIT([linphone],[3.3.99.9],[linphone-developers@nongnu.org])
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_CONFIG_SRCDIR([coreapi/linphonecore.c])
|
||||
|
||||
dnl Source packaging numbers
|
||||
|
||||
|
|
@ -28,7 +29,8 @@ AC_SUBST(LINPHONE_VERSION)
|
|||
AC_MSG_NOTICE([$PACKAGE_NAME-$PACKAGE_VERSION A full featured audio/video sip phone.])
|
||||
AC_MSG_NOTICE([licensed under the terms of the General Public License (GPL)])
|
||||
|
||||
AM_INIT_AUTOMAKE([tar-ustar])
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_SUBST([LIBTOOL_DEPS])
|
||||
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
|
@ -67,7 +69,8 @@ AC_SUBST(CONSOLE_FLAGS)
|
|||
AC_SUBST(GUI_FLAGS)
|
||||
|
||||
dnl localization tools
|
||||
ifdef([IT_PROG_INTLTOOL],[IT_PROG_INTLTOOL],[AC_PROG_INTLTOOL])
|
||||
IT_PROG_INTLTOOL([0.40], [no-xml])
|
||||
|
||||
dnl Initialize libtool
|
||||
AC_LIBTOOL_WIN32_DLL
|
||||
AC_PROG_LIBTOOL
|
||||
|
|
@ -290,11 +293,19 @@ AC_ARG_WITH( ffmpeg,
|
|||
[ --with-ffmpeg Sets the installation prefix of ffmpeg, needed for video support. [default=/usr] ],
|
||||
[ ffmpegdir=${withval}],[ ffmpegdir=/usr ])
|
||||
|
||||
AC_ARG_WITH( sdl,
|
||||
[ --with-sdl Sets the installation prefix of libSDL, needed for video support. [default=/usr] ],
|
||||
[ libsdldir=${withval}],[ libsdldir=/usr ])
|
||||
AC_ARG_ENABLE(x11,
|
||||
[ --disable-x11 Disable X11 support],
|
||||
[case "${enableval}" in
|
||||
yes) enable_x11=true ;;
|
||||
no) enable_x11=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --disable-x11) ;;
|
||||
esac],[enable_x11=true])
|
||||
|
||||
if test "$video" = "true"; then
|
||||
|
||||
if test "$enable_x11" = "true"; then
|
||||
AC_CHECK_HEADERS(X11/Xlib.h)
|
||||
fi
|
||||
AC_DEFINE(VIDEO_ENABLED,1,[defined if video support is available])
|
||||
fi
|
||||
|
||||
|
|
@ -362,15 +373,40 @@ fi
|
|||
|
||||
AC_SUBST(STRICT_OPTIONS)
|
||||
|
||||
AC_CONFIG_SUBDIRS( mediastreamer2 )
|
||||
top_srcdir=`dirname $0`
|
||||
|
||||
AC_ARG_ENABLE([external-mediastreamer],
|
||||
[AS_HELP_STRING([--enable-external-mediastreamer],[Use external mediastreamer library])],,
|
||||
[enable_external_mediastreamer=no])
|
||||
|
||||
AS_CASE($enable_external_mediastreamer,
|
||||
[yes],[
|
||||
PKG_CHECK_MODULES([MEDIASTREAMER], [mediastreamer])
|
||||
MS2_VERSION=`$PKG_CONFIG --modversion mediastreamer`
|
||||
AM_CONDITIONAL(EXTERNAL_MEDIASTREAMER, [true])],
|
||||
[no],[
|
||||
AC_CONFIG_SUBDIRS( mediastreamer2 )
|
||||
MEDIASTREAMER_DIR=${top_srcdir}/mediastreamer2
|
||||
MEDIASTREAMER_CFLAGS="-I\$(top_srcdir)/mediastreamer2/include"
|
||||
MEDIASTREAMER_LIBS="\$(top_builddir)/mediastreamer2/src/libmediastreamer.la"
|
||||
dnl need to temporary change quotes to allow square brackets
|
||||
changequote(<<, >>)
|
||||
MS2_VERSION=`grep -e '^.C_INIT(' $MEDIASTREAMER_DIR/configure.ac | sed -e 's:\([^(]\+\)(\[mediastreamer\],\[\(.*\)\]):\2:g'`
|
||||
changequote([, ])
|
||||
AM_CONDITIONAL(EXTERNAL_MEDIASTREAMER, [false])],
|
||||
[AC_MSG_ERROR([bad value '${enable_external_mediastreamer}' for --enable-external-mediastreamer])])
|
||||
|
||||
AC_SUBST(MEDIASTREAMER_CFLAGS)
|
||||
AC_SUBST(MEDIASTREAMER_LIBS)
|
||||
AC_SUBST([MS2_VERSION])
|
||||
|
||||
dnl check for db2html (docbook) to generate html user manual
|
||||
AC_CHECK_PROG(have_sgmltools,sgmltools, yes, no)
|
||||
AM_CONDITIONAL(ENABLE_MANUAL, test x$have_sgmltools$build_manual = xyesyes )
|
||||
|
||||
dnl for external use of linphone libs
|
||||
LINPHONE_CFLAGS="-I${includedir} -I${includedir}/linphone "
|
||||
LINPHONE_LIBS="-L${libdir} -llinphone"
|
||||
LINPHONE_CFLAGS="-I${includedir} -I${includedir}/linphone"
|
||||
LINPHONE_LIBS="-L${libdir} -llinphone"
|
||||
|
||||
if test x$mingw_found = xyes ; then
|
||||
LINPHONE_LIBS="$LINPHONE_LIBS $OSIP_LIBS"
|
||||
|
|
@ -378,7 +414,6 @@ fi
|
|||
AC_SUBST(LINPHONE_CFLAGS)
|
||||
AC_SUBST(LINPHONE_LIBS)
|
||||
|
||||
|
||||
AC_DEFINE_UNQUOTED(LINPHONE_VERSION,"$PACKAGE_VERSION",[Linphone's version number])
|
||||
|
||||
AC_DEFINE_UNQUOTED(LINPHONE_PLUGINS_DIR, "${package_prefix}/lib/liblinphone/plugins" ,[path of liblinphone plugins, not mediastreamer2 plugins])
|
||||
|
|
@ -394,7 +429,8 @@ AC_ARG_ENABLE(external-ortp,
|
|||
esac],[external_ortp=false])
|
||||
|
||||
if test "$external_ortp" = 'true'; then
|
||||
LP_CHECK_ORTP
|
||||
PKG_CHECK_MODULES([ORTP], [ortp])
|
||||
ORTP_VERSION=`$PKG_CONFIG --modversion ortp`
|
||||
else
|
||||
AC_CONFIG_SUBDIRS( oRTP )
|
||||
ORTP_CFLAGS="-I\$(top_srcdir)/oRTP/include"
|
||||
|
|
@ -402,22 +438,16 @@ else
|
|||
if test x$ac_cv_c_bigendian = xyes ; then
|
||||
ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_BIGENDIAN"
|
||||
fi
|
||||
changequote(<<, >>)
|
||||
ORTP_VERSION=`grep -E ^[AC]+_INIT ${top_srcdir}/oRTP/configure.ac | sed -e 's:^.*_INIT(.*,\[\(.*\)\]):\1:g'`
|
||||
changequote([, ])
|
||||
fi
|
||||
AC_SUBST(ORTP_CFLAGS)
|
||||
AC_SUBST(ORTP_LIBS)
|
||||
AC_SUBST([ORTP_VERSION])
|
||||
|
||||
AM_CONDITIONAL(EXTERNAL_ORTP, [test "$external_ortp" = 'true'])
|
||||
|
||||
dnl Packaging: Pick oRTP version from ${top_srcdir}/oRTP/configure.ac
|
||||
dnl Feel free to propose an alternative & cleaner version...
|
||||
top_srcdir=`dirname $0`
|
||||
changequote(, )dnl
|
||||
ORTP_VERSION=`grep -E ^[AC]+_INIT ${top_srcdir}/oRTP/configure.ac | sed -e 's:^.*_INIT(.*,\[\(.*\)\]):\1:g'`
|
||||
MS2_VERSION=`grep -E ^[AC]+_INIT ${top_srcdir}/mediastreamer2/configure.ac | sed -e 's:^.*_INIT(.*,\[\(.*\)\]):\1:g'`
|
||||
changequote([, ])dnl
|
||||
AC_SUBST([ORTP_VERSION])
|
||||
AC_SUBST([MS2_VERSION])
|
||||
|
||||
dnl ##################################################
|
||||
dnl # Check for doxygen
|
||||
dnl ##################################################
|
||||
|
|
@ -429,12 +459,11 @@ AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false)
|
|||
AC_OUTPUT([
|
||||
Makefile
|
||||
m4/Makefile
|
||||
po/Makefile.in
|
||||
po/Makefile.in
|
||||
pixmaps/Makefile
|
||||
coreapi/Makefile
|
||||
coreapi/help/Makefile
|
||||
coreapi/help/Doxyfile
|
||||
coreapi/help/doxygen.dox
|
||||
gtk/Makefile
|
||||
console/Makefile
|
||||
share/Makefile
|
||||
|
|
@ -9,9 +9,7 @@ INCLUDES = \
|
|||
-I$(top_srcdir)/coreapi\
|
||||
$(ORTP_CFLAGS) \
|
||||
-I$(top_srcdir)/exosip \
|
||||
-I$(top_srcdir)/mediastreamer2/include
|
||||
|
||||
|
||||
$(MEDIASTREAMER_CFLAGS)
|
||||
|
||||
bin_PROGRAMS = linphonec linphonecsh
|
||||
|
||||
|
|
@ -22,7 +20,7 @@ endif
|
|||
linphonec_SOURCES = linphonec.c linphonec.h commands.c
|
||||
linphonec_CFLAGS=$(COMMON_CFLAGS) $(CONSOLE_FLAGS)
|
||||
linphonec_LDADD = $(top_builddir)/coreapi/liblinphone.la $(READLINE_LIBS) \
|
||||
$(top_builddir)/mediastreamer2/src/libmediastreamer.la \
|
||||
$(MEDIASTREAMER_LIBS) \
|
||||
$(ORTP_LIBS) \
|
||||
$(SPEEX_LIBS) \
|
||||
$(OSIP_LIBS)
|
||||
|
|
@ -41,7 +39,7 @@ sipomatic_CFLAGS= $(COMMON_CFLAGS) $(CONSOLE_FLAGS)
|
|||
|
||||
sipomatic_LDADD= $(INTLLIBS) \
|
||||
$(top_builddir)/coreapi/liblinphone.la \
|
||||
$(top_builddir)/mediastreamer2/src/libmediastreamer.la \
|
||||
$(MEDIASTREAMER_LIBS) \
|
||||
$(ORTP_LIBS) \
|
||||
$(SPEEX_LIBS) \
|
||||
$(OSIP_LIBS)
|
||||
|
|
@ -53,6 +51,3 @@ linphonecsh_LDADD = $(ORTP_LIBS)
|
|||
endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
#include <ctype.h>
|
||||
#include <linphonecore.h>
|
||||
#include "linphonec.h"
|
||||
#include "private.h"
|
||||
#include "lpconfig.h"
|
||||
|
||||
#ifndef WIN32
|
||||
|
|
@ -89,6 +88,15 @@ static int lpc_cmd_resume(LinphoneCore *lc, char *args);
|
|||
static int lpc_cmd_mute_mic(LinphoneCore *lc, char *args);
|
||||
static int lpc_cmd_unmute_mic(LinphoneCore *lc, char *args);
|
||||
static int lpc_cmd_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, char *args);
|
||||
#ifdef VIDEO_ENABLED
|
||||
static int lpc_cmd_camera(LinphoneCore *lc, char *args);
|
||||
static int lpc_cmd_video_window(LinphoneCore *lc, char *args);
|
||||
static int lpc_cmd_preview_window(LinphoneCore *lc, char *args);
|
||||
static int lpc_cmd_snapshot(LinphoneCore *lc, char *args);
|
||||
#endif
|
||||
static int lpc_cmd_states(LinphoneCore *lc, char *args);
|
||||
static int lpc_cmd_identify(LinphoneCore *lc, char *args);
|
||||
static int lpc_cmd_ringback(LinphoneCore *lc, char *args);
|
||||
|
||||
/* Command handler helpers */
|
||||
static void linphonec_proxy_add(LinphoneCore *lc);
|
||||
|
|
@ -117,7 +125,8 @@ static LPC_COMMAND *lpc_find_command(const char *name);
|
|||
|
||||
void linphonec_out(const char *fmt,...);
|
||||
|
||||
|
||||
VideoParams lpc_video_params={-1,-1,-1,-1,0,TRUE};
|
||||
VideoParams lpc_preview_params={-1,-1,-1,-1,0,TRUE};
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
|
|
@ -128,13 +137,19 @@ void linphonec_out(const char *fmt,...);
|
|||
/*
|
||||
* Commands table.
|
||||
*/
|
||||
LPC_COMMAND commands[] = {
|
||||
{ "help", lpc_cmd_help, "Print commands help", NULL },
|
||||
{ "call", lpc_cmd_call, "Call a SIP uri",
|
||||
"'call <sip-url>' \t: initiate a call to the specified destination.\n"
|
||||
"'call show' \t: show all the current calls with their id and status.\n"
|
||||
static LPC_COMMAND commands[] = {
|
||||
{ "help", lpc_cmd_help, "Print commands help.",
|
||||
"'help <command>'\t: displays specific help for command.\n"
|
||||
"'help advanced'\t: shows advanced commands.\n"
|
||||
},
|
||||
{ "call", lpc_cmd_call, "Call a SIP uri or number",
|
||||
#ifdef VIDEO_ENABLED
|
||||
"'call <sip-url or number> [--audio-only]' \t: initiate a call to the specified destination.\n"
|
||||
#else
|
||||
"'call <sip-url or number>' \t: initiate a call to the specified destination.\n"
|
||||
#endif
|
||||
},
|
||||
{ "calls", lpc_cmd_calls, "Show all the current calls with their id and status.\n",
|
||||
{ "calls", lpc_cmd_calls, "Show all the current calls with their id and status.",
|
||||
NULL
|
||||
},
|
||||
{ "chat", lpc_cmd_chat, "Chat with a SIP uri",
|
||||
|
|
@ -150,6 +165,28 @@ LPC_COMMAND commands[] = {
|
|||
"'answer' : Answer the current incoming call\n"
|
||||
"'answer <call id>' : Answer the call with given id\n"
|
||||
},
|
||||
{ "pause", lpc_cmd_pause, "pause a call",
|
||||
"'pause' : pause the current call\n"},
|
||||
{ "resume", lpc_cmd_resume, "resume a call",
|
||||
"'resume' : resume the unique call\n"
|
||||
"'resume <call id>' : hold off the call with given id\n"},
|
||||
{ "transfer", lpc_cmd_transfer,
|
||||
"Transfer a call to a specified destination.",
|
||||
"'transfer <sip-uri>' : transfers the current active call to the destination sip-uri\n"
|
||||
"'transfer <call id> <sip-uri>': transfers the call with 'id' to the destination sip-uri\n"
|
||||
"'transfer <call id1> --to-call <call id2>': transfers the call with 'id1' to the destination of call 'id2' (attended transfer)\n"
|
||||
},
|
||||
{ "mute", lpc_cmd_mute_mic,
|
||||
"Mute microphone and suspend voice transmission."},
|
||||
#ifdef VIDEO_ENABLED
|
||||
{ "camera", lpc_cmd_camera, "Send camera output for current call.",
|
||||
"'camera on'\t: allow sending of local camera video to remote end.\n"
|
||||
"'camera off'\t: disable sending of local camera's video to remote end.\n"},
|
||||
#endif
|
||||
{ "unmute", lpc_cmd_unmute_mic,
|
||||
"Unmute microphone and resume voice transmission."},
|
||||
{ "duration", lpc_cmd_duration, "Print duration in seconds of the last call.", NULL },
|
||||
|
||||
{ "autoanswer", lpc_cmd_autoanswer, "Show/set auto-answer mode",
|
||||
"'autoanswer' \t: show current autoanswer mode\n"
|
||||
"'autoanswer enable'\t: enable autoanswer mode\n"
|
||||
|
|
@ -173,20 +210,11 @@ LPC_COMMAND commands[] = {
|
|||
"'webcam list' : list all known devices.\n"
|
||||
"'webcam use <index>' : select a video device.\n"
|
||||
},
|
||||
{ "staticpic", lpc_cmd_staticpic, "Manage static pictures when nowebcam",
|
||||
"'staticpic set' : Set path to picture that should be used.\n"
|
||||
"'staticpic fps' : Get/set frames per seconds for picture emission.\n"
|
||||
},
|
||||
{ "ipv6", lpc_cmd_ipv6, "Use IPV6",
|
||||
"'ipv6 status' : show ipv6 usage status.\n"
|
||||
"'ipv6 enable' : enable the use of the ipv6 network.\n"
|
||||
"'ipv6 disable' : do not use ipv6 network."
|
||||
},
|
||||
{ "transfer", lpc_cmd_transfer,
|
||||
"Transfer a call to a specified destination.",
|
||||
"'transfer <sip-uri>' : transfers the current active call to the destination sip-uri"
|
||||
"'transfer <call id> <sip-uri>': transfers the call with 'id' to the destination sip-uri"
|
||||
},
|
||||
{ "nat", lpc_cmd_nat, "Set nat address",
|
||||
"'nat' : show nat settings.\n"
|
||||
"'nat <addr>' : set nat address.\n"
|
||||
|
|
@ -210,8 +238,10 @@ LPC_COMMAND commands[] = {
|
|||
" there. Don't use '<' '>' around <addr>.\n"
|
||||
"'friend delete <index>' : remove friend, 'all' removes all\n"
|
||||
},
|
||||
{ "play", lpc_cmd_play, "play from a wav file",
|
||||
"This feature is available only in file mode (see 'help soundcard')\n"
|
||||
{ "play", lpc_cmd_play, "play a wav file",
|
||||
"This command has two roles:\n"
|
||||
"Plays a file instead of capturing from soundcard - only available in file mode (see 'help soundcard')\n"
|
||||
"Specifies a wav file to be played to play music to far end when putting it on hold (pause)\n"
|
||||
"'play <wav file>' : play a wav file."
|
||||
},
|
||||
{ "record", lpc_cmd_record, "record to a wav file",
|
||||
|
|
@ -219,9 +249,55 @@ LPC_COMMAND commands[] = {
|
|||
"'record <wav file>' : record into wav file."
|
||||
},
|
||||
{ "quit", lpc_cmd_quit, "Exit linphonec", NULL },
|
||||
{ (char *)NULL, (lpc_cmd_handler)NULL, (char *)NULL, (char *)NULL }
|
||||
};
|
||||
|
||||
|
||||
static LPC_COMMAND advanced_commands[] = {
|
||||
{ "codec", lpc_cmd_acodec, "Audio codec configuration",
|
||||
"'codec list' : list audio codecs\n"
|
||||
"'codec enable <index>' : enable available audio codec\n"
|
||||
"'codec disable <index>' : disable audio codec" },
|
||||
{ "vcodec", lpc_cmd_vcodec, "Video codec configuration",
|
||||
"'vcodec list' : list video codecs\n"
|
||||
"'vcodec enable <index>' : enable available video codec\n"
|
||||
"'vcodec disable <index>' : disable video codec" },
|
||||
{ "ec", lpc_cmd_echocancellation, "Echo cancellation",
|
||||
"'ec on [<delay>] [<tail>] [<framesize>]' : turn EC on with given delay, tail length and framesize\n"
|
||||
"'ec off' : turn echo cancellation (EC) off\n"
|
||||
"'ec show' : show EC status" },
|
||||
{ "nortp-on-audio-mute", lpc_cmd_rtp_no_xmit_on_audio_mute,
|
||||
"Set the rtp_no_xmit_on_audio_mute configuration parameter",
|
||||
" If set to 1 then rtp transmission will be muted when\n"
|
||||
" audio is muted , otherwise rtp is always sent."},
|
||||
#ifdef VIDEO_ENABLED
|
||||
{ "vwindow", lpc_cmd_video_window, "Control video display window",
|
||||
"'vwindow show': shows video window\n"
|
||||
"'vwindow hide': hides video window\n"
|
||||
"'vwindow pos <x> <y>': Moves video window to x,y pixel coordinates\n"
|
||||
"'vwindow size <width> <height>': Resizes video window\n"
|
||||
"'vwindow id <window id>': embeds video display into supplied window id."
|
||||
},
|
||||
{ "pwindow", lpc_cmd_preview_window, "Control local camera video display (preview window)",
|
||||
"'pwindow show': shows the local camera video display\n"
|
||||
"'pwindow hide': hides the local camera video display\n"
|
||||
"'pwindow pos <x> <y>': Moves preview window to x,y pixel coordinates\n"
|
||||
"'pwindow size <width> <height>': Resizes preview window\n"
|
||||
"'pwindow id <window id>': embeds preview display into supplied window id.\n"
|
||||
"'pwindow integrated': integrate preview display within the video window of current call.\n"
|
||||
"'pwindow standalone': use standalone window for preview display."
|
||||
},
|
||||
{ "snapshot", lpc_cmd_snapshot, "Take a snapshot of currently received video stream",
|
||||
"'snapshot <file path>': take a snapshot and records it in jpeg format into the supplied path\n"
|
||||
},
|
||||
#endif
|
||||
{ "states", lpc_cmd_states, "Show internal states of liblinphone, registrations and calls, according to linphonecore.h definitions",
|
||||
"'states global': shows global state of liblinphone \n"
|
||||
"'states calls': shows state of calls\n"
|
||||
"'states proxies': shows state of proxy configurations"
|
||||
},
|
||||
{ "register", lpc_cmd_register, "Register in one line to a proxy" , "register <sip identity> <sip proxy> <password>"},
|
||||
{ "unregister", lpc_cmd_unregister, "Unregister from default proxy", NULL },
|
||||
{ "duration", lpc_cmd_duration, "Print duration in seconds of the last call.", NULL },
|
||||
{ "status", lpc_cmd_status, "Print various status information",
|
||||
"'status register' \t: print status concerning registration\n"
|
||||
"'status autoanswer'\t: tell whether autoanswer mode is enabled\n"
|
||||
|
|
@ -234,34 +310,23 @@ LPC_COMMAND commands[] = {
|
|||
"'speak <voice name> <sentence>' : speak a text using the specified espeak voice.\n"
|
||||
"Example for english voice: 'speak default Hello my friend !'"
|
||||
},
|
||||
{ "codec", lpc_cmd_acodec, "Audio codec configuration",
|
||||
"'codec list' : list audio codecs\n"
|
||||
"'codec enable <index>' : enable available audio codec\n"
|
||||
"'codec disable <index>' : disable audio codec" },
|
||||
{ "vcodec", lpc_cmd_vcodec, "Video codec configuration",
|
||||
"'vcodec list' : list video codecs\n"
|
||||
"'vcodec enable <index>' : enable available video codec\n"
|
||||
"'vcodec disable <index>' : disable video codec" },
|
||||
{ "ec", lpc_cmd_echocancellation, "Echo cancellation",
|
||||
"'ec on [<delay>] [<tail>] [<framesize>]' : turn EC on with given delay, tail length and framesize\n"
|
||||
"'ec off' : turn echo cancellation (EC) off\n"
|
||||
"'ec show' : show EC status" },
|
||||
{ "pause", lpc_cmd_pause, "pause a call",
|
||||
"'pause' : pause the current call\n"},
|
||||
{ "resume", lpc_cmd_resume, "resume a call",
|
||||
"'resume' : resume the unique call\n"
|
||||
"'resume <call id>' : hold off the call with given id\n"},
|
||||
{ "mute", lpc_cmd_mute_mic,
|
||||
"Mute microphone and suspend voice transmission."},
|
||||
{ "unmute", lpc_cmd_unmute_mic,
|
||||
"Unmute microphone and resume voice transmission."},
|
||||
{ "nortp-on-audio-mute", lpc_cmd_rtp_no_xmit_on_audio_mute,
|
||||
"Set the rtp_no_xmit_on_audio_mute configuration parameter",
|
||||
" If set to 1 then rtp transmission will be muted when\n"
|
||||
" audio is muted , otherwise rtp is always sent."},
|
||||
{ (char *)NULL, (lpc_cmd_handler)NULL, (char *)NULL, (char *)NULL }
|
||||
{ "staticpic", lpc_cmd_staticpic, "Manage static pictures when nowebcam",
|
||||
"'staticpic set' : Set path to picture that should be used.\n"
|
||||
"'staticpic fps' : Get/set frames per seconds for picture emission.\n"
|
||||
},
|
||||
{ "identify", lpc_cmd_identify, "Returns the user-agent string of far end",
|
||||
"'identify' \t: returns remote user-agent string for current call.\n"
|
||||
"'identify <id>' \t: returns remote user-agent string for call with supplied id.\n"
|
||||
},
|
||||
{ "ringback", lpc_cmd_ringback, "Specifies a ringback tone to be played to remote end during incoming calls",
|
||||
"'ringback <path of mono .wav file>'\t: Specifies a ringback tone to be played to remote end during incoming calls\n"
|
||||
"'ringback disable'\t: Disable playing of ringback tone to callers\n"
|
||||
},
|
||||
{ NULL,NULL,NULL,NULL}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* Public interface
|
||||
|
|
@ -332,29 +397,43 @@ linphonec_parse_command_line(LinphoneCore *lc, char *cl)
|
|||
char *
|
||||
linphonec_command_generator(const char *text, int state)
|
||||
{
|
||||
static int index, len;
|
||||
static int index, len, adv;
|
||||
char *name;
|
||||
|
||||
if ( ! state )
|
||||
{
|
||||
index=0;
|
||||
adv=0;
|
||||
len=strlen(text);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the next name which partially matches
|
||||
* from the commands list
|
||||
*/
|
||||
while ((name=commands[index].name))
|
||||
{
|
||||
++index; /* so next call get next command */
|
||||
|
||||
if (strncmp(name, text, len) == 0)
|
||||
if (adv==0){
|
||||
while ((name=commands[index].name))
|
||||
{
|
||||
return ortp_strdup(name);
|
||||
++index; /* so next call get next command */
|
||||
|
||||
if (strncmp(name, text, len) == 0)
|
||||
{
|
||||
return ortp_strdup(name);
|
||||
}
|
||||
}
|
||||
adv=1;
|
||||
index=0;
|
||||
}
|
||||
if (adv==1){
|
||||
while ((name=advanced_commands[index].name))
|
||||
{
|
||||
++index; /* so next call get next command */
|
||||
|
||||
if (strncmp(name, text, len) == 0)
|
||||
{
|
||||
return ortp_strdup(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -384,11 +463,28 @@ lpc_cmd_help(LinphoneCore *lc, char *arg)
|
|||
}
|
||||
|
||||
linphonec_out("---------------------------\n");
|
||||
linphonec_out("Type 'help <command>' for more details.\n");
|
||||
linphonec_out("Type 'help <command>' for more details or 'help advanced' to list additional commands.\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (strcmp(arg,"advanced")==0){
|
||||
linphonec_out("Advanced commands are:\n");
|
||||
linphonec_out("---------------------------\n");
|
||||
i=0;
|
||||
while (advanced_commands[i].help)
|
||||
{
|
||||
linphonec_out("%10.10s\t%s\n", advanced_commands[i].name,
|
||||
advanced_commands[i].help);
|
||||
i++;
|
||||
}
|
||||
|
||||
linphonec_out("---------------------------\n");
|
||||
linphonec_out("Type 'help <command>' for more details.\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
cmd=lpc_find_command(arg);
|
||||
if ( !cmd )
|
||||
{
|
||||
|
|
@ -445,12 +541,19 @@ lpc_cmd_call(LinphoneCore *lc, char *args)
|
|||
}
|
||||
{
|
||||
LinphoneCall *call;
|
||||
LinphoneCallParams *cp=linphone_core_create_default_call_parameters (lc);
|
||||
char *opt;
|
||||
if ( linphone_core_in_call(lc) )
|
||||
{
|
||||
linphonec_out("Terminate or hold on the current call first.\n");
|
||||
return 1;
|
||||
}
|
||||
if ( NULL == (call=linphone_core_invite(lc, args)) )
|
||||
opt=strstr(args,"--audio-only");
|
||||
if (opt){
|
||||
opt[0]='\0';
|
||||
linphone_call_params_enable_video (cp,FALSE);
|
||||
}
|
||||
if ( NULL == (call=linphone_core_invite_with_params(lc, args,cp)) )
|
||||
{
|
||||
linphonec_out("Error from linphone_core_invite.\n");
|
||||
}
|
||||
|
|
@ -458,6 +561,7 @@ lpc_cmd_call(LinphoneCore *lc, char *args)
|
|||
{
|
||||
snprintf(callee_name,sizeof(callee_name),"%s",args);
|
||||
}
|
||||
linphone_call_params_destroy(cp);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -534,13 +638,15 @@ lpc_cmd_transfer(LinphoneCore *lc, char *args)
|
|||
{
|
||||
if (args){
|
||||
LinphoneCall *call;
|
||||
LinphoneCall *call2;
|
||||
const char *refer_to=NULL;
|
||||
char arg1[256]={0};
|
||||
char arg2[266]={0};
|
||||
int n=sscanf(args,"%s %s",arg1,arg2);
|
||||
long id2=0;
|
||||
int n=sscanf(args,"%s %s %li",arg1,arg2,&id2);
|
||||
if (n==1 || isalpha(*arg1)){
|
||||
call=linphone_core_get_current_call(lc);
|
||||
if (call==NULL && linphone_core_get_calls_nb (lc)==1){
|
||||
if (call==NULL && ms_list_size(linphone_core_get_calls(lc))==1){
|
||||
call=(LinphoneCall*)linphone_core_get_calls(lc)->data;
|
||||
}
|
||||
refer_to=args;
|
||||
|
|
@ -548,13 +654,24 @@ lpc_cmd_transfer(LinphoneCore *lc, char *args)
|
|||
linphonec_out("No active call, please specify a call id among the ones listed by 'calls' command.\n");
|
||||
return 0;
|
||||
}
|
||||
}else{
|
||||
linphone_core_transfer_call(lc, call, refer_to);
|
||||
}else if (n==2){
|
||||
long id=atoi(arg1);
|
||||
refer_to=args+strlen(arg1)+1;
|
||||
call=linphonec_get_call(id);
|
||||
if (call==NULL) return 0;
|
||||
}
|
||||
linphone_core_transfer_call(lc, call, refer_to);
|
||||
linphone_core_transfer_call(lc, call, refer_to);
|
||||
}else if (n==3){
|
||||
long id=atoi(arg1);
|
||||
call=linphonec_get_call(id);
|
||||
call2=linphonec_get_call(id2);
|
||||
if (call==NULL || call2==NULL) return 0;
|
||||
if (strcmp(arg2,"--to-call")!=0){
|
||||
return 0;
|
||||
}
|
||||
linphonec_out("Performing attended transfer of call %i to call %i",id,id2);
|
||||
linphone_core_transfer_call_to_another (lc,call,call2);
|
||||
}else return 0;
|
||||
}else{
|
||||
linphonec_out("Transfer command requires at least one argument\n");
|
||||
return 0;
|
||||
|
|
@ -566,7 +683,7 @@ static int
|
|||
lpc_cmd_terminate(LinphoneCore *lc, char *args)
|
||||
{
|
||||
if (linphone_core_get_calls(lc)==NULL){
|
||||
linphonec_out("No active calls");
|
||||
linphonec_out("No active calls\n");
|
||||
return 1;
|
||||
}
|
||||
if (!args)
|
||||
|
|
@ -587,7 +704,7 @@ lpc_cmd_terminate(LinphoneCore *lc, char *args)
|
|||
LinphoneCall *call=linphonec_get_call(id);
|
||||
if (call){
|
||||
if (linphone_core_terminate_call(lc,call)==-1){
|
||||
linphonec_out("Could not stop the call with id %li",id);
|
||||
linphonec_out("Could not stop the call with id %li\n",id);
|
||||
}
|
||||
}else return 0;
|
||||
return 1;
|
||||
|
|
@ -1361,7 +1478,7 @@ linphonec_proxy_add(LinphoneCore *lc)
|
|||
}
|
||||
|
||||
linphone_proxy_config_set_identity(cfg, clean);
|
||||
if ( ! cfg->reg_identity )
|
||||
if ( ! linphone_proxy_config_get_identity (cfg))
|
||||
{
|
||||
linphonec_out("Invalid identity (sip:name@sip.domain.tld).\n");
|
||||
free(input);
|
||||
|
|
@ -1430,7 +1547,7 @@ linphonec_proxy_add(LinphoneCore *lc)
|
|||
}
|
||||
|
||||
linphone_proxy_config_expires(cfg, expires);
|
||||
linphonec_out("Expiration: %d seconds\n", cfg->expires);
|
||||
linphonec_out("Expiration: %d seconds\n", linphone_proxy_config_get_expires (cfg));
|
||||
|
||||
free(input);
|
||||
break;
|
||||
|
|
@ -1460,7 +1577,7 @@ linphonec_proxy_add(LinphoneCore *lc)
|
|||
}
|
||||
|
||||
linphone_proxy_config_set_route(cfg, clean);
|
||||
if ( ! cfg->reg_route )
|
||||
if ( ! linphone_proxy_config_get_route(cfg) )
|
||||
{
|
||||
linphonec_out("Invalid route.\n");
|
||||
free(input);
|
||||
|
|
@ -1524,12 +1641,14 @@ linphonec_proxy_add(LinphoneCore *lc)
|
|||
static void
|
||||
linphonec_proxy_display(LinphoneProxyConfig *cfg)
|
||||
{
|
||||
const char *route=linphone_proxy_config_get_route(cfg);
|
||||
const char *identity=linphone_proxy_config_get_identity(cfg);
|
||||
linphonec_out("sip address: %s\nroute: %s\nidentity: %s\nregister: %s\nexpires: %i\nregistered: %s\n",
|
||||
cfg->reg_proxy,
|
||||
(cfg->reg_route!=NULL)?cfg->reg_route:"",
|
||||
(cfg->reg_identity!=NULL)?cfg->reg_identity:"",
|
||||
(cfg->reg_sendregister)?"yes":"no",
|
||||
cfg->expires,
|
||||
linphone_proxy_config_get_addr(cfg),
|
||||
(route!=NULL)? route:"",
|
||||
(identity!=NULL)?identity:"",
|
||||
linphone_proxy_config_register_enabled (cfg)?"yes":"no",
|
||||
linphone_proxy_config_get_expires (cfg),
|
||||
linphone_proxy_config_is_registered(cfg) ? "yes" : "no");
|
||||
}
|
||||
|
||||
|
|
@ -1577,8 +1696,7 @@ linphonec_proxy_remove(LinphoneCore *lc, int index)
|
|||
return;
|
||||
}
|
||||
linphone_core_remove_proxy_config(lc,cfg);
|
||||
linphonec_out("Proxy %s removed.\n", cfg->reg_proxy);
|
||||
linphone_proxy_config_destroy(cfg);
|
||||
linphonec_out("Proxy %s removed.\n", linphone_proxy_config_get_addr(cfg));
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -1960,14 +2078,13 @@ static int lpc_cmd_codec(int type, LinphoneCore *lc, char *args){
|
|||
|
||||
static void linphonec_codec_list(int type, LinphoneCore *lc){
|
||||
PayloadType *pt;
|
||||
codecs_config_t *config=&lc->codecs_conf;
|
||||
int index=0;
|
||||
MSList *node=NULL;
|
||||
const MSList *node=NULL;
|
||||
|
||||
if (type == AUDIO) {
|
||||
node=config->audio_codecs;
|
||||
node=linphone_core_get_audio_codecs(lc);
|
||||
} else if(type==VIDEO) {
|
||||
node=config->video_codecs;
|
||||
node=linphone_core_get_video_codecs(lc);
|
||||
}
|
||||
|
||||
for(;node!=NULL;node=ms_list_next(node)){
|
||||
|
|
@ -1980,20 +2097,19 @@ static void linphonec_codec_list(int type, LinphoneCore *lc){
|
|||
|
||||
static void linphonec_codec_enable(int type, LinphoneCore *lc, int sel_index){
|
||||
PayloadType *pt;
|
||||
codecs_config_t *config=&lc->codecs_conf;
|
||||
int index=0;
|
||||
MSList *node=NULL;
|
||||
const MSList *node=NULL;
|
||||
|
||||
if (type == AUDIO) {
|
||||
node=config->audio_codecs;
|
||||
} else if(type==VIDEO) {
|
||||
node=config->video_codecs;
|
||||
}
|
||||
if (type == AUDIO) {
|
||||
node=linphone_core_get_audio_codecs(lc);
|
||||
} else if(type==VIDEO) {
|
||||
node=linphone_core_get_video_codecs(lc);
|
||||
}
|
||||
|
||||
for(;node!=NULL;node=ms_list_next(node)){
|
||||
if (index == sel_index || sel_index == -1) {
|
||||
pt=(PayloadType*)(node->data);
|
||||
pt->flags|=PAYLOAD_TYPE_ENABLED;
|
||||
linphone_core_enable_payload_type (lc,pt,TRUE);
|
||||
linphonec_out("%2d: %s (%d) %s\n", index, pt->mime_type, pt->clock_rate, "enabled");
|
||||
}
|
||||
index++;
|
||||
|
|
@ -2002,22 +2118,21 @@ static void linphonec_codec_enable(int type, LinphoneCore *lc, int sel_index){
|
|||
|
||||
static void linphonec_codec_disable(int type, LinphoneCore *lc, int sel_index){
|
||||
PayloadType *pt;
|
||||
codecs_config_t *config=&lc->codecs_conf;
|
||||
int index=0;
|
||||
MSList *node=NULL;
|
||||
const MSList *node=NULL;
|
||||
|
||||
if (type == AUDIO) {
|
||||
node=config->audio_codecs;
|
||||
} else if(type==VIDEO) {
|
||||
node=config->video_codecs;
|
||||
}
|
||||
if (type == AUDIO) {
|
||||
node=linphone_core_get_audio_codecs(lc);
|
||||
} else if(type==VIDEO) {
|
||||
node=linphone_core_get_video_codecs(lc);
|
||||
}
|
||||
|
||||
for(;node!=NULL;node=ms_list_next(node)){
|
||||
if (index == sel_index || sel_index == -1) {
|
||||
pt=(PayloadType*)(node->data);
|
||||
pt->flags&=~PAYLOAD_TYPE_ENABLED;
|
||||
linphonec_out("%2d: %s (%d) %s\n", index, pt->mime_type, pt->clock_rate, "disabled");
|
||||
}
|
||||
if (index == sel_index || sel_index == -1) {
|
||||
pt=(PayloadType*)(node->data);
|
||||
linphone_core_enable_payload_type (lc,pt,FALSE);
|
||||
linphonec_out("%2d: %s (%d) %s\n", index, pt->mime_type, pt->clock_rate, "disabled");
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
|
@ -2026,6 +2141,7 @@ static int lpc_cmd_echocancellation(LinphoneCore *lc, char *args){
|
|||
char *arg1 = args;
|
||||
char *arg2 = NULL;
|
||||
char *ptr = args;
|
||||
LpConfig *config=linphone_core_get_config(lc);
|
||||
|
||||
if (!args) return 0;
|
||||
|
||||
|
|
@ -2048,16 +2164,16 @@ static int lpc_cmd_echocancellation(LinphoneCore *lc, char *args){
|
|||
n = sscanf(arg2, "%d %d %d", &delay, &tail_len, &frame_size);
|
||||
|
||||
if (n == 1) {
|
||||
lp_config_set_int(lc->config,"sound","ec_delay",delay);
|
||||
lp_config_set_int(config,"sound","ec_delay",delay);
|
||||
}
|
||||
else if (n == 2) {
|
||||
lp_config_set_int(lc->config,"sound","ec_delay",delay);
|
||||
lp_config_set_int(lc->config,"sound","ec_tail_len",tail_len);
|
||||
lp_config_set_int(config,"sound","ec_delay",delay);
|
||||
lp_config_set_int(config,"sound","ec_tail_len",tail_len);
|
||||
}
|
||||
else if (n == 3) {
|
||||
lp_config_set_int(lc->config,"sound","ec_delay",delay);
|
||||
lp_config_set_int(lc->config,"sound","ec_tail_len",tail_len);
|
||||
lp_config_set_int(lc->config,"sound","ec_framesize",frame_size);
|
||||
lp_config_set_int(config,"sound","ec_delay",delay);
|
||||
lp_config_set_int(config,"sound","ec_tail_len",tail_len);
|
||||
lp_config_set_int(config,"sound","ec_framesize",frame_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2067,9 +2183,9 @@ static int lpc_cmd_echocancellation(LinphoneCore *lc, char *args){
|
|||
else if (strcmp(arg1,"show")==0){
|
||||
linphonec_out("echo cancellation is %s; delay %d, tail length %d, frame size %d\n",
|
||||
linphone_core_echo_cancellation_enabled(lc) ? "on" : "off",
|
||||
lp_config_get_int(lc->config,"sound","ec_delay",0),
|
||||
lp_config_get_int(lc->config,"sound","ec_tail_len",0),
|
||||
lp_config_get_int(lc->config,"sound","ec_framesize",0));
|
||||
lp_config_get_int(config,"sound","ec_delay",0),
|
||||
lp_config_get_int(config,"sound","ec_tail_len",0),
|
||||
lp_config_get_int(config,"sound","ec_framesize",0));
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
|
|
@ -2108,6 +2224,223 @@ static int lpc_cmd_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, char *args)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifdef VIDEO_ENABLED
|
||||
static int _lpc_cmd_video_window(LinphoneCore *lc, char *args, bool_t is_preview){
|
||||
char subcommand[64];
|
||||
int a,b;
|
||||
int err;
|
||||
VideoParams *params=is_preview ? &lpc_preview_params : &lpc_video_params;
|
||||
|
||||
if (!args) return 0;
|
||||
err=sscanf(args,"%s %i %i",subcommand,&a,&b);
|
||||
if (err>=1){
|
||||
if (strcmp(subcommand,"pos")==0){
|
||||
if (err<3) return 0;
|
||||
params->x=a;
|
||||
params->y=b;
|
||||
params->refresh=TRUE;
|
||||
}else if (strcmp(subcommand,"size")==0){
|
||||
if (err<3) return 0;
|
||||
params->w=a;
|
||||
params->h=b;
|
||||
params->refresh=TRUE;
|
||||
}else if (strcmp(subcommand,"show")==0){
|
||||
params->show=TRUE;
|
||||
params->refresh=TRUE;
|
||||
if (is_preview) linphone_core_enable_video_preview (lc,TRUE);
|
||||
}else if (strcmp(subcommand,"hide")==0){
|
||||
params->show=FALSE;
|
||||
params->refresh=TRUE;
|
||||
if (is_preview) linphone_core_enable_video_preview (lc,FALSE);
|
||||
}else if (strcmp(subcommand,"id")==0){
|
||||
if (err == 1){
|
||||
linphonec_out("vwindow id: 0x%x\n",is_preview ? linphone_core_get_native_preview_window_id (lc) :
|
||||
linphone_core_get_native_video_window_id (lc));
|
||||
return 1;
|
||||
} else if (err != 2) return 0;
|
||||
params->wid=a;
|
||||
if (is_preview)
|
||||
linphone_core_set_native_preview_window_id (lc,a);
|
||||
else
|
||||
linphone_core_set_native_video_window_id(lc,a);
|
||||
}else if (is_preview==TRUE){
|
||||
if (strcmp(subcommand,"integrated")==0){
|
||||
linphone_core_use_preview_window (lc,FALSE);
|
||||
}else if (strcmp(subcommand,"standalone")==0){
|
||||
linphone_core_use_preview_window(lc,TRUE);
|
||||
}else return 0;
|
||||
}else return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lpc_cmd_video_window(LinphoneCore *lc, char *args){
|
||||
return _lpc_cmd_video_window(lc, args, FALSE);
|
||||
}
|
||||
|
||||
static int lpc_cmd_preview_window(LinphoneCore *lc, char *args){
|
||||
return _lpc_cmd_video_window(lc, args, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void lpc_display_global_state(LinphoneCore *lc){
|
||||
linphonec_out("Global liblinphone state\n%s\n",
|
||||
linphone_global_state_to_string(linphone_core_get_global_state(lc)));
|
||||
}
|
||||
|
||||
static void lpc_display_call_states(LinphoneCore *lc){
|
||||
LinphoneCall *call;
|
||||
const MSList *elem;
|
||||
char *tmp;
|
||||
linphonec_out("Call states\n"
|
||||
"Id | Destination | State\n"
|
||||
"---------------------------------------------------------------\n");
|
||||
elem=linphone_core_get_calls(lc);
|
||||
if (elem==NULL){
|
||||
linphonec_out("(empty)\n");
|
||||
}else{
|
||||
for(;elem!=NULL;elem=elem->next){
|
||||
call=(LinphoneCall*)elem->data;
|
||||
tmp=linphone_call_get_remote_address_as_string (call);
|
||||
linphonec_out("%-2i | %-35s | %s\n",(int)(long)linphone_call_get_user_pointer(call),
|
||||
tmp,linphone_call_state_to_string(linphone_call_get_state(call)));
|
||||
ms_free(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void lpc_display_proxy_states(LinphoneCore *lc){
|
||||
const MSList *elem;
|
||||
linphonec_out("Proxy registration states\n"
|
||||
" Identity | State\n"
|
||||
"------------------------------------------------------------\n");
|
||||
elem=linphone_core_get_proxy_config_list (lc);
|
||||
if (elem==NULL) linphonec_out("(empty)\n");
|
||||
else {
|
||||
for(;elem!=NULL;elem=elem->next){
|
||||
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
|
||||
linphonec_out("%-40s | %s\n",linphone_proxy_config_get_identity (cfg),
|
||||
linphone_registration_state_to_string(linphone_proxy_config_get_state(cfg)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int lpc_cmd_states(LinphoneCore *lc, char *args){
|
||||
if (args==NULL) {
|
||||
lpc_display_global_state(lc);
|
||||
lpc_display_call_states(lc);
|
||||
lpc_display_proxy_states(lc);
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(args,"global")==0){
|
||||
lpc_display_global_state(lc);
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(args,"proxies")==0){
|
||||
lpc_display_proxy_states(lc);
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(args,"calls")==0){
|
||||
lpc_display_call_states(lc);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef VIDEO_ENABLED
|
||||
static int lpc_cmd_camera(LinphoneCore *lc, char *args){
|
||||
LinphoneCall *call=linphone_core_get_current_call(lc);
|
||||
bool_t activated=FALSE;
|
||||
|
||||
if (linphone_core_video_enabled (lc)==FALSE){
|
||||
linphonec_out("Video is disabled, re-run linphonec with -V option.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (args){
|
||||
if (strcmp(args,"on")==0)
|
||||
activated=TRUE;
|
||||
else if (strcmp(args,"off")==0)
|
||||
activated=FALSE;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (call==NULL){
|
||||
if (args){
|
||||
linphonec_camera_enabled=activated;
|
||||
}
|
||||
if (linphonec_camera_enabled){
|
||||
linphonec_out("Camera is enabled. Video stream will be setup immediately for outgoing and incoming calls.\n");
|
||||
}else{
|
||||
linphonec_out("Camera is disabled. Calls will be established with audio-only, with the possibility to later add video using 'camera on'.\n");
|
||||
}
|
||||
}else{
|
||||
const LinphoneCallParams *cp=linphone_call_get_current_params (call);
|
||||
if (args){
|
||||
linphone_call_enable_camera(call,activated);
|
||||
if ((activated && !linphone_call_params_video_enabled (cp))){
|
||||
/*update the call to add the video stream*/
|
||||
LinphoneCallParams *ncp=linphone_call_params_copy(cp);
|
||||
linphone_call_params_enable_video(ncp,TRUE);
|
||||
linphone_core_update_call(lc,call,ncp);
|
||||
linphone_call_params_destroy (ncp);
|
||||
linphonec_out("Trying to bring up video stream...\n");
|
||||
}
|
||||
}
|
||||
if (linphone_call_camera_enabled (call))
|
||||
linphonec_out("Camera is allowed for current call.\n");
|
||||
else linphonec_out("Camera is dis-allowed for current call.\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lpc_cmd_snapshot(LinphoneCore *lc, char *args){
|
||||
LinphoneCall *call;
|
||||
if (!args) return 0;
|
||||
call=linphone_core_get_current_call(lc);
|
||||
if (call!=NULL){
|
||||
linphone_call_take_video_snapshot (call,args);
|
||||
linphonec_out("Taking video snaphot in file %s\n", args);
|
||||
}else linphonec_out("There is no active call.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int lpc_cmd_identify(LinphoneCore *lc, char *args){
|
||||
LinphoneCall *call;
|
||||
const char *remote_ua;
|
||||
if (args==NULL){
|
||||
call=linphone_core_get_current_call(lc);
|
||||
if (call==NULL) {
|
||||
linphonec_out("There is currently running call. Specify call id.\n");
|
||||
return 0;
|
||||
}
|
||||
}else{
|
||||
call=linphonec_get_call(atoi(args));
|
||||
if (call==NULL){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
remote_ua=linphone_call_get_remote_user_agent(call);
|
||||
if (remote_ua){
|
||||
linphonec_out("Remote user agent string is: %s\n",remote_ua);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lpc_cmd_ringback(LinphoneCore *lc, char *args){
|
||||
if (!args) return 0;
|
||||
if (strcmp(args,"disable")==0){
|
||||
linphone_core_set_remote_ringback_tone(lc,NULL);
|
||||
linphonec_out("Disabling ringback tone.\n");
|
||||
return 1;
|
||||
}
|
||||
linphone_core_set_remote_ringback_tone (lc,args);
|
||||
linphonec_out("Using %s as ringback tone to be played to callers.",args);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
|
|
@ -2129,6 +2462,12 @@ lpc_find_command(const char *name)
|
|||
return &commands[i];
|
||||
}
|
||||
|
||||
for (i=0; advanced_commands[i].name; ++i)
|
||||
{
|
||||
if (strcmp(name, advanced_commands[i].name) == 0)
|
||||
return &advanced_commands[i];
|
||||
}
|
||||
|
||||
return (LPC_COMMAND *)NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,11 @@
|
|||
#define PACKAGE_DIR ""
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_X11_XLIB_H
|
||||
#include <X11/Xlib.h>
|
||||
#include <SDL/SDL_syswm.h>
|
||||
#endif
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* Types
|
||||
|
|
@ -125,7 +130,7 @@ static void linphonec_new_unknown_subscriber(LinphoneCore *lc,
|
|||
LinphoneFriend *lf, const char *url);
|
||||
|
||||
static void linphonec_text_received(LinphoneCore *lc, LinphoneChatRoom *cr,
|
||||
const char *from, const char *msg);
|
||||
const LinphoneAddress *from, const char *msg);
|
||||
static void linphonec_display_status (LinphoneCore * lc, const char *something);
|
||||
static void linphonec_dtmf_received(LinphoneCore *lc, LinphoneCall *call, int dtmf);
|
||||
static void print_prompt(LinphoneCore *opm);
|
||||
|
|
@ -155,6 +160,7 @@ LPC_AUTH_STACK auth_stack;
|
|||
static int trace_level = 0;
|
||||
static char *logfile_name = NULL;
|
||||
static char configfile_name[PATH_MAX];
|
||||
static const char *factory_configfile_name=NULL;
|
||||
static char *sipAddr = NULL; /* for autocall */
|
||||
#if !defined(_WIN32_WCE)
|
||||
static ortp_pipe_t client_sock=ORTP_PIPE_INVALID;
|
||||
|
|
@ -168,6 +174,9 @@ static bool_t pipe_reader_run=FALSE;
|
|||
static ortp_pipe_t server_sock;
|
||||
#endif /*_WIN32_WCE*/
|
||||
|
||||
bool_t linphonec_camera_enabled=TRUE;
|
||||
|
||||
|
||||
|
||||
void linphonec_call_identify(LinphoneCall* call){
|
||||
static long callid=1;
|
||||
|
|
@ -183,7 +192,7 @@ LinphoneCall *linphonec_get_call(long id){
|
|||
return call;
|
||||
}
|
||||
}
|
||||
linphonec_out("Sorry, no call with id %i exists at this time.",id);
|
||||
linphonec_out("Sorry, no call with id %i exists at this time.\n",id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -199,7 +208,7 @@ LinphoneCall *linphonec_get_call(long id){
|
|||
static void
|
||||
linphonec_display_refer (LinphoneCore * lc, const char *refer_to)
|
||||
{
|
||||
linphonec_out("Receiving out of call refer to %s", refer_to);
|
||||
linphonec_out("Receiving out of call refer to %s\n", refer_to);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -306,6 +315,13 @@ linphonec_new_unknown_subscriber(LinphoneCore *lc, LinphoneFriend *lf,
|
|||
|
||||
}
|
||||
|
||||
static void linphonec_call_updated(LinphoneCall *call){
|
||||
const LinphoneCallParams *cp=linphone_call_get_current_params(call);
|
||||
if (!linphone_call_camera_enabled (call) && linphone_call_params_video_enabled (cp)){
|
||||
linphonec_out("Far end requests to share video.\nType 'camera on' if you agree.\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState st, const char *msg){
|
||||
char *from=linphone_call_get_remote_address_as_string(call);
|
||||
long id=(long)linphone_call_get_user_pointer (call);
|
||||
|
|
@ -330,16 +346,20 @@ static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, L
|
|||
break;
|
||||
case LinphoneCallIncomingReceived:
|
||||
linphonec_call_identify(call);
|
||||
linphone_call_enable_camera (call,linphonec_camera_enabled);
|
||||
id=(long)linphone_call_get_user_pointer (call);
|
||||
linphonec_set_caller(from);
|
||||
if ( auto_answer) {
|
||||
answer_call=TRUE;
|
||||
}
|
||||
linphonec_out("Receiving new incoming call from %s, assigned id %i", from,id);
|
||||
linphonec_out("Receiving new incoming call from %s, assigned id %i\n", from,id);
|
||||
break;
|
||||
case LinphoneCallOutgoingInit:
|
||||
linphonec_call_identify(call);
|
||||
break;
|
||||
case LinphoneCallUpdatedByRemote:
|
||||
linphonec_call_updated(call);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -351,9 +371,9 @@ static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, L
|
|||
*/
|
||||
static void
|
||||
linphonec_text_received(LinphoneCore *lc, LinphoneChatRoom *cr,
|
||||
const char *from, const char *msg)
|
||||
const LinphoneAddress *from, const char *msg)
|
||||
{
|
||||
printf("%s: %s\n", from, msg);
|
||||
printf("%s: %s\n", linphone_address_as_string(from), msg);
|
||||
// TODO: provide mechanism for answering.. ('say' command?)
|
||||
}
|
||||
|
||||
|
|
@ -578,7 +598,7 @@ main (int argc, char *argv[]) {
|
|||
#endif
|
||||
linphonec_vtable.call_state_changed=linphonec_call_state_changed;
|
||||
linphonec_vtable.notify_presence_recv = linphonec_notify_presence_received;
|
||||
linphonec_vtable.new_unknown_subscriber = linphonec_new_unknown_subscriber;
|
||||
linphonec_vtable.new_subscription_request = linphonec_new_unknown_subscriber;
|
||||
linphonec_vtable.auth_info_requested = linphonec_prompt_for_auth;
|
||||
linphonec_vtable.display_status = linphonec_display_status;
|
||||
linphonec_vtable.display_message=linphonec_display_something;
|
||||
|
|
@ -676,8 +696,7 @@ linphonec_init(int argc, char **argv)
|
|||
/*
|
||||
* Initialize linphone core
|
||||
*/
|
||||
linphonec=linphone_core_new (&linphonec_vtable, configfile_name, NULL,
|
||||
NULL);
|
||||
linphonec=linphone_core_new (&linphonec_vtable, configfile_name, factory_configfile_name, NULL);
|
||||
linphone_core_enable_video(linphonec,vcap_enabled,display_enabled);
|
||||
linphone_core_enable_video_preview(linphonec,preview_enabled);
|
||||
if (!(vcap_enabled || display_enabled)) printf("Warning: video is disabled in linphonec, use -V or -C or -D to enable.\n");
|
||||
|
|
@ -709,6 +728,10 @@ void linphonec_main_loop_exit(void){
|
|||
void
|
||||
linphonec_finish(int exit_status)
|
||||
{
|
||||
// Do not allow concurrent destroying to prevent glibc errors
|
||||
static bool_t terminating=FALSE;
|
||||
if (terminating) return;
|
||||
terminating=TRUE;
|
||||
linphonec_out("Terminating...\n");
|
||||
|
||||
/* Terminate any pending call */
|
||||
|
|
@ -727,7 +750,7 @@ linphonec_finish(int exit_status)
|
|||
{
|
||||
fclose (mylogfile);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
exit(exit_status);
|
||||
|
||||
}
|
||||
|
|
@ -827,6 +850,7 @@ print_usage (int exit_status)
|
|||
usage: linphonec [-c file] [-s sipaddr] [-a] [-V] [-d level ] [-l logfile]\n\
|
||||
linphonec -v\n\
|
||||
\n\
|
||||
-b file specify path of readonly factory configuration file.\n\
|
||||
-c file specify path of configuration file.\n\
|
||||
-d level be verbose. 0 is no output. 6 is all output\n\
|
||||
-l logfile specify the log file for your SIP phone\n\
|
||||
|
|
@ -841,6 +865,75 @@ usage: linphonec [-c file] [-s sipaddr] [-a] [-V] [-d level ] [-l logfile]\n\
|
|||
exit(exit_status);
|
||||
}
|
||||
|
||||
#ifdef VIDEO_ENABLED
|
||||
|
||||
#ifdef HAVE_X11_XLIB_H
|
||||
static void x11_apply_video_params(VideoParams *params, Window window){
|
||||
XWindowChanges wc;
|
||||
unsigned int flags=0;
|
||||
static Display *display = NULL;
|
||||
const char *dname=getenv("DISPLAY");
|
||||
|
||||
if (display==NULL && dname!=NULL){
|
||||
display=XOpenDisplay(dname);
|
||||
}
|
||||
|
||||
if (display==NULL){
|
||||
ms_error("Could not open display %s",dname);
|
||||
return;
|
||||
}
|
||||
memset(&wc,0,sizeof(wc));
|
||||
wc.x=params->x;
|
||||
wc.y=params->y;
|
||||
wc.width=params->w;
|
||||
wc.height=params->h;
|
||||
if (params->x!=-1 ){
|
||||
flags|=CWX|CWY;
|
||||
}
|
||||
if (params->w!=-1){
|
||||
flags|=CWWidth|CWHeight;
|
||||
}
|
||||
/*printf("XConfigureWindow x=%i,y=%i,w=%i,h=%i\n",
|
||||
wc.x, wc.y ,wc.width, wc.height);*/
|
||||
XConfigureWindow(display,window,flags,&wc);
|
||||
if (params->show)
|
||||
XMapWindow(display,window);
|
||||
else
|
||||
XUnmapWindow(display,window);
|
||||
XSync(display,FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void lpc_apply_video_params(){
|
||||
static unsigned long old_wid=0,old_pwid=0;
|
||||
unsigned long wid=linphone_core_get_native_video_window_id (linphonec);
|
||||
unsigned long pwid=linphone_core_get_native_preview_window_id (linphonec);
|
||||
|
||||
if (wid!=0 && (lpc_video_params.refresh || old_wid!=wid)){
|
||||
lpc_video_params.refresh=FALSE;
|
||||
#ifdef HAVE_X11_XLIB_H
|
||||
if (lpc_video_params.wid==0){ // do not manage window if embedded
|
||||
x11_apply_video_params(&lpc_video_params,wid);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
old_wid=wid;
|
||||
if (pwid!=0 && (lpc_preview_params.refresh || old_pwid!=pwid)){
|
||||
lpc_preview_params.refresh=FALSE;
|
||||
#ifdef HAVE_X11_XLIB_H
|
||||
/*printf("wid=%lu pwid=%lu\n",wid,pwid);*/
|
||||
if (lpc_preview_params.wid==0){ // do not manage window if embedded
|
||||
printf("Refreshing\n");
|
||||
x11_apply_video_params(&lpc_preview_params,pwid);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
old_pwid=pwid;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
@ -882,6 +975,10 @@ linphonec_idle_call ()
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef VIDEO_ENABLED
|
||||
lpc_apply_video_params();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1054,6 +1151,20 @@ linphonec_parse_cmdline(int argc, char **argv)
|
|||
#endif /*_WIN32_WCE*/
|
||||
snprintf(configfile_name, PATH_MAX, "%s", argv[arg_num]);
|
||||
}
|
||||
else if (strncmp ("-b", argv[arg_num], 2) == 0)
|
||||
{
|
||||
if ( ++arg_num >= argc ) print_usage(EXIT_FAILURE);
|
||||
#if !defined(_WIN32_WCE)
|
||||
if (access(argv[arg_num],F_OK)!=0 )
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Cannot open config file %s.\n",
|
||||
argv[arg_num]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif /*_WIN32_WCE*/
|
||||
factory_configfile_name = argv[arg_num];
|
||||
}
|
||||
else if (strncmp ("-s", argv[arg_num], 2) == 0)
|
||||
{
|
||||
arg_num++;
|
||||
|
|
|
|||
|
|
@ -97,6 +97,17 @@ typedef struct {
|
|||
char *doc; /* Long description. */
|
||||
} LPC_COMMAND;
|
||||
|
||||
typedef struct {
|
||||
int x,y,w,h;
|
||||
unsigned long wid;
|
||||
bool_t show;
|
||||
bool_t refresh;
|
||||
} VideoParams;
|
||||
|
||||
|
||||
extern VideoParams lpc_video_params;
|
||||
extern VideoParams lpc_preview_params;
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* Forward declarations
|
||||
|
|
@ -115,6 +126,8 @@ void linphonec_set_caller(const char *caller);
|
|||
LinphoneCall *linphonec_get_call(long id);
|
||||
void linphonec_call_identify(LinphoneCall* call);
|
||||
|
||||
extern bool_t linphonec_camera_enabled;
|
||||
|
||||
#endif /* def LINPHONEC_H */
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ EXTRA_DIST=linphonecore_jni.cc
|
|||
## Process this file with automake to produce Makefile.in
|
||||
linphone_includedir=$(includedir)/linphone
|
||||
|
||||
linphone_include_HEADERS=linphonecore.h linphonecore_utils.h ../config.h lpconfig.h sipsetup.h
|
||||
linphone_include_HEADERS=linphonecore.h linphonefriend.h linphonecore_utils.h ../config.h lpconfig.h sipsetup.h
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir)\
|
||||
-I$(top_srcdir)/mediastreamer2/include
|
||||
$(MEDIASTREAMER_CFLAGS)
|
||||
|
||||
|
||||
lib_LTLIBRARIES=liblinphone.la
|
||||
|
|
@ -42,7 +42,7 @@ liblinphone_la_LDFLAGS= -version-info $(LIBLINPHONE_SO_VERSION) -no-undefined
|
|||
|
||||
liblinphone_la_LIBADD= \
|
||||
$(EXOSIP_LIBS) \
|
||||
$(top_builddir)/mediastreamer2/src/libmediastreamer.la \
|
||||
$(MEDIASTREAMER_LIBS) \
|
||||
$(ORTP_LIBS)
|
||||
|
||||
if BUILD_WIN32
|
||||
|
|
@ -53,11 +53,14 @@ noinst_PROGRAMS=test_lsd
|
|||
|
||||
test_lsd_SOURCES=test_lsd.c
|
||||
|
||||
test_lsd_LDADD=liblinphone.la
|
||||
test_lsd_LDADD=liblinphone.la \
|
||||
$(MEDIASTREAMER_LIBS) \
|
||||
$(ORTP_LIBS)
|
||||
|
||||
AM_CFLAGS=$(STRICT_OPTIONS) -DIN_LINPHONE \
|
||||
$(ORTP_CFLAGS) \
|
||||
$(OSIP_CFLAGS) \
|
||||
$(MEDIASTREAMER_CFLAGS) \
|
||||
$(EXOSIP_CFLAGS) \
|
||||
-DENABLE_TRACE \
|
||||
-DLOG_DOMAIN=\"LinphoneCore\" \
|
||||
|
|
|
|||
|
|
@ -129,6 +129,29 @@ char *linphone_address_as_string_uri_only(const LinphoneAddress *u){
|
|||
return sal_address_as_string_uri_only(u);
|
||||
}
|
||||
|
||||
static bool_t strings_equals(const char *s1, const char *s2){
|
||||
if (s1==NULL && s2==NULL) return TRUE;
|
||||
if (s1!=NULL && s2!=NULL && strcmp(s1,s2)==0) return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two LinphoneAddress ignoring tags and headers, basically just domain, username, and port.
|
||||
* Returns TRUE if they are equal.
|
||||
**/
|
||||
bool_t linphone_address_weak_equal(const LinphoneAddress *a1, const LinphoneAddress *a2){
|
||||
const char *u1,*u2;
|
||||
const char *h1,*h2;
|
||||
int p1,p2;
|
||||
u1=linphone_address_get_username(a1);
|
||||
u2=linphone_address_get_username(a2);
|
||||
p1=linphone_address_get_port_int(a1);
|
||||
p2=linphone_address_get_port_int(a2);
|
||||
h1=linphone_address_get_domain(a1);
|
||||
h2=linphone_address_get_domain(a2);
|
||||
return strings_equals(u1,u2) && strings_equals(h1,h2) && p1==p2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys a LinphoneAddress object.
|
||||
**/
|
||||
|
|
@ -139,6 +162,7 @@ void linphone_address_destroy(LinphoneAddress *u){
|
|||
int linphone_address_get_port_int(const LinphoneAddress *u) {
|
||||
return sal_address_get_port_int(u);
|
||||
}
|
||||
|
||||
const char* linphone_address_get_port(const LinphoneAddress *u) {
|
||||
return sal_address_get_port(u);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "linphonecore.h"
|
||||
#include "private.h"
|
||||
#include "mediastreamer2/mediastream.h"
|
||||
#include "lpconfig.h"
|
||||
|
||||
static void register_failure(SalOp *op, SalError error, SalReason reason, const char *details);
|
||||
|
||||
static void linphone_connect_incoming(LinphoneCore *lc, LinphoneCall *call){
|
||||
if (lc->ringstream!=NULL){
|
||||
|
|
@ -33,6 +35,18 @@ static void linphone_connect_incoming(LinphoneCore *lc, LinphoneCall *call){
|
|||
linphone_call_start_media_streams(call);
|
||||
}
|
||||
|
||||
static bool_t is_duplicate_call(LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to){
|
||||
MSList *elem;
|
||||
for(elem=lc->calls;elem!=NULL;elem=elem->next){
|
||||
LinphoneCall *call=(LinphoneCall*)elem->data;
|
||||
if (linphone_address_weak_equal(call->log->from,from) &&
|
||||
linphone_address_weak_equal(call->log->to, to)){
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void call_received(SalOp *h){
|
||||
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(h));
|
||||
char *barmesg;
|
||||
|
|
@ -40,7 +54,9 @@ static void call_received(SalOp *h){
|
|||
const char *from,*to;
|
||||
char *tmp;
|
||||
LinphoneAddress *from_parsed;
|
||||
|
||||
LinphoneAddress *from_addr, *to_addr;
|
||||
const char * early_media=linphone_core_get_remote_ringback_tone (lc);
|
||||
|
||||
/* first check if we can answer successfully to this invite */
|
||||
if (lc->presence_mode==LinphoneStatusBusy ||
|
||||
lc->presence_mode==LinphoneStatusOffline ||
|
||||
|
|
@ -64,9 +80,18 @@ static void call_received(SalOp *h){
|
|||
}
|
||||
from=sal_op_get_from(h);
|
||||
to=sal_op_get_to(h);
|
||||
from_addr=linphone_address_new(from);
|
||||
to_addr=linphone_address_new(to);
|
||||
|
||||
if (is_duplicate_call(lc,from_addr,to_addr)){
|
||||
ms_warning("Receiving duplicated call, refusing this one.");
|
||||
sal_call_decline(h,SalReasonBusy,NULL);
|
||||
linphone_address_destroy(from_addr);
|
||||
linphone_address_destroy(to_addr);
|
||||
return;
|
||||
}
|
||||
|
||||
call=linphone_call_new_incoming(lc,linphone_address_new(from),linphone_address_new(to),h);
|
||||
|
||||
call=linphone_call_new_incoming(lc,from_addr,to_addr,h);
|
||||
sal_call_set_local_media_description(h,call->localdesc);
|
||||
call->resultdesc=sal_call_get_final_media_description(h);
|
||||
if (call->resultdesc)
|
||||
|
|
@ -76,19 +101,15 @@ static void call_received(SalOp *h){
|
|||
linphone_call_unref(call);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* the call is acceptable so we can now add it to our list */
|
||||
if(linphone_core_add_call(lc,call)!= 0)
|
||||
{
|
||||
ms_warning("we cannot handle anymore call\n");
|
||||
sal_call_decline(h,SalReasonMedia,NULL);
|
||||
linphone_call_unref(call);
|
||||
return;
|
||||
}
|
||||
linphone_core_add_call(lc,call);
|
||||
|
||||
from_parsed=linphone_address_new(sal_op_get_from(h));
|
||||
linphone_address_clean(from_parsed);
|
||||
tmp=linphone_address_as_string(from_parsed);
|
||||
linphone_address_destroy(from_parsed);
|
||||
linphone_call_set_state(call,LinphoneCallIncomingReceived,"Incoming call");
|
||||
barmesg=ortp_strdup_printf("%s %s%s",tmp,_("is contacting you"),
|
||||
(sal_call_autoanswer_asked(h)) ?_(" and asked autoanswer."):_("."));
|
||||
if (lc->vtable.show) lc->vtable.show(lc);
|
||||
|
|
@ -115,12 +136,20 @@ static void call_received(SalOp *h){
|
|||
}else{
|
||||
/*TODO : play a tone within the context of the current call */
|
||||
}
|
||||
sal_call_notify_ringing(h);
|
||||
sal_call_notify_ringing(h,early_media!=NULL);
|
||||
#if !(__IPHONE_OS_VERSION_MIN_REQUIRED >= 40000)
|
||||
linphone_call_init_media_streams(call);
|
||||
if (early_media!=NULL){
|
||||
linphone_call_start_early_media (call);
|
||||
}
|
||||
#endif
|
||||
ms_free(barmesg);
|
||||
ms_free(tmp);
|
||||
|
||||
linphone_call_set_state(call,LinphoneCallIncomingReceived,"Incoming call");
|
||||
if (sal_call_get_replaces(call->op)!=NULL && lp_config_get_int(lc->config,"sip","auto_answer_replacing_calls",1)){
|
||||
linphone_core_accept_call(lc,call);
|
||||
}
|
||||
}
|
||||
|
||||
static void call_ringing(SalOp *h){
|
||||
|
|
@ -272,6 +301,8 @@ static void call_ack(SalOp *op){
|
|||
static void call_updating(SalOp *op){
|
||||
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
|
||||
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
|
||||
LinphoneCallState prevstate=LinphoneCallIdle;
|
||||
|
||||
if (call->resultdesc)
|
||||
sal_media_description_unref(call->resultdesc);
|
||||
call->resultdesc=sal_call_get_final_media_description(op);
|
||||
|
|
@ -294,26 +325,35 @@ static void call_updating(SalOp *op){
|
|||
linphone_call_set_state (call,LinphoneCallStreamsRunning,"Connected (streams running)");
|
||||
}
|
||||
else if(call->state==LinphoneCallStreamsRunning &&
|
||||
sal_media_description_has_dir(call->resultdesc,SalStreamRecvOnly) && !strcmp(call->resultdesc->addr,"0.0.0.0")){
|
||||
( sal_media_description_has_dir(call->resultdesc,SalStreamRecvOnly)
|
||||
|| sal_media_description_has_dir(call->resultdesc,SalStreamInactive)
|
||||
|| strcmp(call->resultdesc->addr,"0.0.0.0")==0)){
|
||||
if(lc->vtable.display_status)
|
||||
lc->vtable.display_status(lc,_("We are being paused..."));
|
||||
linphone_call_set_state (call,LinphoneCallPausedByRemote,"Call paused by remote");
|
||||
if (lc->current_call!=call){
|
||||
ms_error("Inconsitency detected: current call is %p but call %p is being paused !",lc->current_call,call);
|
||||
}
|
||||
}else{
|
||||
prevstate=call->state;
|
||||
linphone_call_set_state(call, LinphoneCallUpdatedByRemote,"Call updated by remote");
|
||||
}
|
||||
/*accept the modification (sends a 200Ok)*/
|
||||
sal_call_accept(op);
|
||||
linphone_call_stop_media_streams (call);
|
||||
linphone_call_init_media_streams (call);
|
||||
linphone_call_start_media_streams (call);
|
||||
if (prevstate!=LinphoneCallIdle){
|
||||
linphone_call_set_state (call,prevstate,"Connected (streams running)");
|
||||
}
|
||||
}
|
||||
if (lc->current_call==NULL) linphone_core_start_pending_refered_calls (lc);
|
||||
}
|
||||
|
||||
static void call_terminated(SalOp *op, const char *from){
|
||||
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
|
||||
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
|
||||
|
||||
if (call==NULL) return;
|
||||
|
||||
if (linphone_call_get_state(call)==LinphoneCallEnd || linphone_call_get_state(call)==LinphoneCallError){
|
||||
ms_warning("call_terminated: ignoring.");
|
||||
|
|
@ -408,8 +448,10 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de
|
|||
}
|
||||
linphone_call_stop_media_streams (call);
|
||||
if (sr!=SalReasonDeclined) linphone_call_set_state(call,LinphoneCallError,msg);
|
||||
else linphone_call_set_state(call,LinphoneCallEnd,"Call declined.");
|
||||
|
||||
else{
|
||||
call->reason=LinphoneReasonDeclined;
|
||||
linphone_call_set_state(call,LinphoneCallEnd,"Call declined.");
|
||||
}
|
||||
}
|
||||
|
||||
static void auth_requested(SalOp *h, const char *realm, const char *username){
|
||||
|
|
@ -426,6 +468,9 @@ static void auth_requested(SalOp *h, const char *realm, const char *username){
|
|||
sal_op_authenticate(h,&sai);
|
||||
ai->usecount++;
|
||||
}else{
|
||||
if (ai && ai->works==FALSE) {
|
||||
register_failure(h, SalErrorFailure, SalReasonForbidden, _("Authentication failure"));
|
||||
}
|
||||
if (lc->vtable.auth_info_requested)
|
||||
lc->vtable.auth_info_requested(lc,realm,username);
|
||||
}
|
||||
|
|
@ -446,6 +491,7 @@ static void register_success(SalOp *op, bool_t registered){
|
|||
char *msg;
|
||||
|
||||
cfg->registered=registered;
|
||||
linphone_proxy_config_set_error(cfg,LinphoneReasonNone);
|
||||
linphone_proxy_config_set_state(cfg, registered ? LinphoneRegistrationOk : LinphoneRegistrationCleared ,
|
||||
registered ? "Registration sucessful" : "Unregistration done");
|
||||
if (lc->vtable.display_status){
|
||||
|
|
@ -473,6 +519,11 @@ static void register_failure(SalOp *op, SalError error, SalReason reason, const
|
|||
lc->vtable.display_status(lc,msg);
|
||||
ms_free(msg);
|
||||
}
|
||||
if (error== SalErrorFailure && reason == SalReasonForbidden) {
|
||||
linphone_proxy_config_set_error(cfg, LinphoneReasonBadCredentials);
|
||||
} else if (error == SalErrorNoResponse) {
|
||||
linphone_proxy_config_set_error(cfg, LinphoneReasonNoResponse);
|
||||
}
|
||||
linphone_proxy_config_set_state(cfg,LinphoneRegistrationFailed,details);
|
||||
}
|
||||
|
||||
|
|
@ -510,11 +561,15 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){
|
|||
lc->vtable.display_status(lc,msg);
|
||||
ms_free(msg);
|
||||
}
|
||||
if (lc->current_call==NULL) linphone_core_start_pending_refered_calls (lc);
|
||||
sal_refer_accept(op);
|
||||
if (call->state!=LinphoneCallPaused){
|
||||
ms_message("Automatically pausing current call to accept transfer.");
|
||||
linphone_core_pause_call(lc,call);
|
||||
}
|
||||
linphone_core_start_refered_call(lc,call);
|
||||
sal_call_accept_refer(op);
|
||||
}else if (lc->vtable.refer_received){
|
||||
lc->vtable.refer_received(lc,referto);
|
||||
sal_refer_accept(op);
|
||||
sal_call_accept_refer(op);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@
|
|||
cr->lc=lc;
|
||||
cr->peer=linphone_address_as_string(parsed_url);
|
||||
cr->peer_url=parsed_url;
|
||||
cr->route=ms_strdup(linphone_core_get_route(lc));
|
||||
lc->chatrooms=ms_list_append(lc->chatrooms,(void *)cr);
|
||||
return cr;
|
||||
}
|
||||
|
|
@ -46,21 +45,29 @@
|
|||
lc->chatrooms=ms_list_remove(lc->chatrooms,(void *) cr);
|
||||
linphone_address_destroy(cr->peer_url);
|
||||
ms_free(cr->peer);
|
||||
ms_free(cr->route);
|
||||
if (cr->op)
|
||||
sal_op_release(cr->op);
|
||||
}
|
||||
|
||||
void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg){
|
||||
const char *identity=linphone_core_get_identity(cr->lc);
|
||||
const char *route=NULL;
|
||||
const char *identity=linphone_core_find_best_identity(cr->lc,cr->peer_url,&route);
|
||||
SalOp *op;
|
||||
if(linphone_core_is_in_communication_with(cr->lc,cr->peer))
|
||||
LinphoneCall *call;
|
||||
if((call = linphone_core_get_call_by_remote_address(cr->lc,cr->peer))!=NULL)
|
||||
{
|
||||
ms_message("send SIP message into the call\n");
|
||||
op = (linphone_core_get_current_call(cr->lc))->op;
|
||||
op = call->op;
|
||||
}
|
||||
else
|
||||
{
|
||||
op = sal_op_new(cr->lc->sal);
|
||||
sal_op_set_route(op,cr->route);
|
||||
sal_op_set_route(op,route);
|
||||
if (cr->op!=NULL){
|
||||
sal_op_release (cr->op);
|
||||
cr->op=NULL;
|
||||
}
|
||||
cr->op=op;
|
||||
}
|
||||
sal_text_send(op,identity,cr->peer,msg);
|
||||
}
|
||||
|
|
@ -71,7 +78,7 @@ bool_t linphone_chat_room_matches(LinphoneChatRoom *cr, const LinphoneAddress *f
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void linphone_chat_room_text_received(LinphoneChatRoom *cr, LinphoneCore *lc, const char *from, const char *msg){
|
||||
void linphone_chat_room_text_received(LinphoneChatRoom *cr, LinphoneCore *lc, const LinphoneAddress *from, const char *msg){
|
||||
if (lc->vtable.text_received!=NULL) lc->vtable.text_received(lc, cr, from, msg);
|
||||
}
|
||||
|
||||
|
|
@ -95,8 +102,9 @@ void linphone_core_text_received(LinphoneCore *lc, const char *from, const char
|
|||
/* create a new chat room */
|
||||
cr=linphone_core_create_chat_room(lc,cleanfrom);
|
||||
}
|
||||
|
||||
linphone_address_destroy(addr);
|
||||
linphone_chat_room_text_received(cr,lc,cleanfrom,msg);
|
||||
linphone_chat_room_text_received(cr,lc,cr->peer_url,msg);
|
||||
ms_free(cleanfrom);
|
||||
}
|
||||
|
||||
|
|
@ -107,3 +115,6 @@ void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void * ud){
|
|||
void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr){
|
||||
return cr->user_data;
|
||||
}
|
||||
const LinphoneAddress* linphone_chat_room_get_peer_address(LinphoneChatRoom *cr) {
|
||||
return cr->peer_url;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,31 +68,11 @@ const char *linphone_online_status_to_string(LinphoneOnlineStatus ss){
|
|||
return str;
|
||||
}
|
||||
|
||||
static int friend_data_compare(const void * a, const void * b, void * data){
|
||||
static int friend_compare(const void * a, const void * b){
|
||||
LinphoneAddress *fa=((LinphoneFriend*)a)->uri;
|
||||
LinphoneAddress *fb=((LinphoneFriend*)b)->uri;
|
||||
const char *ua,*ub;
|
||||
ua=linphone_address_get_username(fa);
|
||||
ub=linphone_address_get_username(fb);
|
||||
if (ua!=NULL && ub!=NULL) {
|
||||
//printf("Comparing usernames %s,%s\n",ua,ub);
|
||||
return strcasecmp(ua,ub);
|
||||
}
|
||||
else {
|
||||
/* compare hosts*/
|
||||
ua=linphone_address_get_domain(fa);
|
||||
ub=linphone_address_get_domain(fb);
|
||||
if (ua!=NULL && ub!=NULL){
|
||||
int ret=strcasecmp(ua,ub);
|
||||
//printf("Comparing hostnames %s,%s,res=%i\n",ua,ub,ret);
|
||||
return ret;
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static int friend_compare(const void * a, const void * b){
|
||||
return friend_data_compare(a,b,NULL);
|
||||
if (linphone_address_weak_equal (fa,fb)) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -128,6 +108,7 @@ void __linphone_friend_do_subscribe(LinphoneFriend *fr){
|
|||
char *friend=NULL;
|
||||
const char *route=NULL;
|
||||
const char *from=NULL;
|
||||
const char *fixed_contact=NULL;
|
||||
LinphoneProxyConfig *cfg;
|
||||
|
||||
friend=linphone_address_as_string(fr->uri);
|
||||
|
|
@ -135,6 +116,12 @@ void __linphone_friend_do_subscribe(LinphoneFriend *fr){
|
|||
if (cfg!=NULL){
|
||||
route=linphone_proxy_config_get_route(cfg);
|
||||
from=linphone_proxy_config_get_identity(cfg);
|
||||
if (cfg->op){
|
||||
fixed_contact=sal_op_get_contact(cfg->op);
|
||||
if (fixed_contact) {
|
||||
ms_message("Contact for subscribe has been fixed using proxy to %s",fixed_contact);
|
||||
}
|
||||
}
|
||||
}else from=linphone_core_get_primary_contact(fr->lc);
|
||||
if (fr->outsub==NULL){
|
||||
/* people for which we don't have yet an answer should appear as offline */
|
||||
|
|
@ -149,6 +136,7 @@ void __linphone_friend_do_subscribe(LinphoneFriend *fr){
|
|||
}
|
||||
fr->outsub=sal_op_new(fr->lc->sal);
|
||||
sal_op_set_route(fr->outsub,route);
|
||||
sal_op_set_contact(fr->outsub,fixed_contact);
|
||||
sal_subscribe_presence(fr->outsub,from,friend);
|
||||
fr->subscribe_active=TRUE;
|
||||
ms_free(friend);
|
||||
|
|
@ -163,8 +151,13 @@ LinphoneFriend * linphone_friend_new(){
|
|||
}
|
||||
|
||||
LinphoneFriend *linphone_friend_new_with_addr(const char *addr){
|
||||
LinphoneAddress* linphone_address = linphone_address_new(addr);
|
||||
if (linphone_address == NULL) {
|
||||
ms_error("Cannot create friend for address [%s]",addr?addr:"null");
|
||||
return NULL;
|
||||
}
|
||||
LinphoneFriend *fr=linphone_friend_new();
|
||||
if (linphone_friend_set_sip_addr(fr,addr)<0){
|
||||
if (linphone_friend_set_addr(fr,linphone_address)<0){
|
||||
linphone_friend_destroy(fr);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -208,8 +201,8 @@ void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char
|
|||
linphone_address_destroy(fr);
|
||||
}
|
||||
|
||||
int linphone_friend_set_sip_addr(LinphoneFriend *lf, const char *addr){
|
||||
LinphoneAddress *fr=linphone_address_new(addr);
|
||||
int linphone_friend_set_addr(LinphoneFriend *lf, const LinphoneAddress *addr){
|
||||
LinphoneAddress *fr=linphone_address_clone(addr);
|
||||
if (fr==NULL) {
|
||||
ms_warning("Invalid friend sip uri: %s",addr);
|
||||
return -1;
|
||||
|
|
@ -230,7 +223,7 @@ int linphone_friend_set_name(LinphoneFriend *lf, const char *name){
|
|||
return 0;
|
||||
}
|
||||
|
||||
int linphone_friend_send_subscribe(LinphoneFriend *fr, bool_t val){
|
||||
int linphone_friend_enable_subscribes(LinphoneFriend *fr, bool_t val){
|
||||
fr->subscribe=val;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -367,6 +360,7 @@ void linphone_friend_apply(LinphoneFriend *fr, LinphoneCore *lc){
|
|||
}
|
||||
ms_message("linphone_friend_apply() done.");
|
||||
lc->bl_refresh=TRUE;
|
||||
fr->commit=FALSE;
|
||||
}
|
||||
|
||||
void linphone_friend_edit(LinphoneFriend *fr){
|
||||
|
|
@ -391,7 +385,8 @@ void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf)
|
|||
return ;
|
||||
}
|
||||
lc->friends=ms_list_append(lc->friends,lf);
|
||||
linphone_friend_apply(lf,lc);
|
||||
if ( linphone_core_ready(lc)) linphone_friend_apply(lf,lc);
|
||||
else lf->commit=TRUE;
|
||||
return ;
|
||||
}
|
||||
|
||||
|
|
@ -404,6 +399,15 @@ void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend* fl){
|
|||
}
|
||||
}
|
||||
|
||||
void linphone_core_send_initial_subscribes(LinphoneCore *lc){
|
||||
const MSList *elem;
|
||||
for(elem=lc->friends;elem!=NULL;elem=elem->next){
|
||||
LinphoneFriend *f=(LinphoneFriend*)elem->data;
|
||||
if (f->commit)
|
||||
linphone_friend_apply(f,lc);
|
||||
}
|
||||
}
|
||||
|
||||
void linphone_friend_set_ref_key(LinphoneFriend *lf, const char *key){
|
||||
if (lf->refkey!=NULL){
|
||||
ms_free(lf->refkey);
|
||||
|
|
@ -562,7 +566,7 @@ void linphone_core_write_friends_config(LinphoneCore* lc)
|
|||
{
|
||||
MSList *elem;
|
||||
int i;
|
||||
if (!lc->ready) return; /*dont write config when reading it !*/
|
||||
if (! linphone_core_ready(lc)) return; /*dont write config when reading it !*/
|
||||
for (elem=lc->friends,i=0; elem!=NULL; elem=ms_list_next(elem),i++){
|
||||
linphone_friend_write_to_config_file(lc->config,(LinphoneFriend*)elem->data,i);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
EXTRA_DIST = Doxyfile.in doxygen.dox.in
|
||||
EXTRA_DIST = Doxyfile.in doxygen.dox
|
||||
|
||||
SOURCES=$(top_srcdir)/coreapi/*.h $(top_srcdir)/coreapi/*.c
|
||||
SOURCES= doxygen.dox $(top_srcdir)/coreapi/help/*.c $(top_srcdir)/coreapi/*.c $(top_srcdir)/coreapi/*.h
|
||||
|
||||
|
||||
#html doc
|
||||
|
|
@ -32,18 +32,35 @@ endif
|
|||
clean-local:
|
||||
rm -rf doc
|
||||
|
||||
noinst_PROGRAMS=helloworld
|
||||
noinst_PROGRAMS=helloworld registration buddy_status chatroom
|
||||
|
||||
helloworld_SOURCES=helloworld.c
|
||||
|
||||
helloworld_LDADD=$(top_builddir)/coreapi/liblinphone.la
|
||||
helloworld_LDADD=$(top_builddir)/coreapi/liblinphone.la \
|
||||
$(MEDIASTREAMER_LIBS) \
|
||||
$(ORTP_LIBS)
|
||||
|
||||
registration_SOURCES=registration.c
|
||||
|
||||
registration_LDADD=$(helloworld_LDADD)
|
||||
|
||||
buddy_status_SOURCES=buddy_status.c
|
||||
|
||||
buddy_status_LDADD=$(helloworld_LDADD)
|
||||
|
||||
chatroom_SOURCES=chatroom.c
|
||||
|
||||
chatroom_LDADD=$(helloworld_LDADD)
|
||||
|
||||
|
||||
|
||||
INCLUDES=-I$(top_srcdir)/coreapi \
|
||||
-I$(top_srcdir)/mediastreamer2/include
|
||||
$(MEDIASTREAMER_CFLAGS)
|
||||
|
||||
AM_CFLAGS=$(STRICT_OPTIONS) -DIN_LINPHONE \
|
||||
$(ORTP_CFLAGS) \
|
||||
$(OSIP_CFLAGS) \
|
||||
$(MEDIASTREAMER_CFLAGS) \
|
||||
$(EXOSIP_CFLAGS) \
|
||||
-DENABLE_TRACE \
|
||||
-DLOG_DOMAIN=\"LinphoneCore\" \
|
||||
|
|
|
|||
137
coreapi/help/buddy_status.c
Normal file
137
coreapi/help/buddy_status.c
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
|
||||
/*
|
||||
buddy_status
|
||||
Copyright (C) 2010 Belledonne Communications SARL
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup buddy_tutorials Basic buddy status notification
|
||||
* @ingroup tutorials
|
||||
*This program is a _very_ simple usage example of liblinphone,
|
||||
*demonstrating how to initiate SIP subscriptions and receive notifications from a sip uri identity passed from the command line.
|
||||
*<br>Argument must be like sip:jehan@sip.linphone.org .
|
||||
*<br>
|
||||
*ex budy_list sip:jehan@sip.linphone.org
|
||||
*<br>Subscription is cleared on SIGINT
|
||||
*<br>
|
||||
*@include buddy_status.c
|
||||
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef IN_LINPHONE
|
||||
#include "linphonecore.h"
|
||||
#else
|
||||
#include "linphone/linphonecore.h"
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
static bool_t running=TRUE;
|
||||
|
||||
static void stop(int signum){
|
||||
running=FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* presence state change notification callback
|
||||
*/
|
||||
static void notify_presence_recv_updated (LinphoneCore *lc, LinphoneFriend *friend) {
|
||||
const LinphoneAddress* friend_address = linphone_friend_get_address(friend);
|
||||
printf("New state state [%s] for user id [%s] \n"
|
||||
,linphone_online_status_to_string(linphone_friend_get_status(friend))
|
||||
,linphone_address_as_string (friend_address));
|
||||
}
|
||||
static void new_subscription_request (LinphoneCore *lc, LinphoneFriend *friend, const char* url) {
|
||||
const LinphoneAddress* friend_address = linphone_friend_get_address(friend);
|
||||
printf(" [%s] wants to see your status, accepting\n"
|
||||
,linphone_address_as_string (friend_address));
|
||||
linphone_friend_edit(friend); /* start editing friend */
|
||||
linphone_friend_set_inc_subscribe_policy(friend,LinphoneSPAccept); /* Accept incoming subscription request for this friend*/
|
||||
linphone_friend_done(friend); /*commit change*/
|
||||
linphone_core_add_friend(lc,friend); /* add this new friend to the buddy list*/
|
||||
|
||||
}
|
||||
|
||||
LinphoneCore *lc;
|
||||
int main(int argc, char *argv[]){
|
||||
LinphoneCoreVTable vtable={0};
|
||||
|
||||
char* dest_friend=NULL;
|
||||
|
||||
|
||||
/* takes sip uri identity from the command line arguments */
|
||||
if (argc>1){
|
||||
dest_friend=argv[1];
|
||||
}
|
||||
|
||||
signal(SIGINT,stop);
|
||||
//#define DEBUG
|
||||
#ifdef DEBUG
|
||||
linphone_core_enable_logs(NULL); /*enable liblinphone logs.*/
|
||||
#endif
|
||||
/*
|
||||
Fill the LinphoneCoreVTable with application callbacks.
|
||||
All are optional. Here we only use the both notify_presence_recv and new_subscription_request callbacks
|
||||
in order to get notifications about friend status.
|
||||
*/
|
||||
vtable.notify_presence_recv=notify_presence_recv_updated;
|
||||
vtable.new_subscription_request=new_subscription_request;
|
||||
|
||||
/*
|
||||
Instantiate a LinphoneCore object given the LinphoneCoreVTable
|
||||
*/
|
||||
lc=linphone_core_new(&vtable,NULL,NULL,NULL);
|
||||
LinphoneFriend* my_friend=NULL;
|
||||
|
||||
if (dest_friend) {
|
||||
my_friend = linphone_friend_new_with_addr(dest_friend); /*creates friend object from dest*/
|
||||
if (my_friend == NULL) {
|
||||
printf("bad destination uri for friend [%s]\n",dest_friend);
|
||||
goto end;
|
||||
}
|
||||
|
||||
linphone_friend_enable_subscribes(my_friend,TRUE); /*configure this friend to emit SUBSCRIBE message after being added to LinphoneCore*/
|
||||
linphone_friend_set_inc_subscribe_policy(my_friend,LinphoneSPAccept); /* Accept incoming subscription request for this friend*/
|
||||
linphone_core_add_friend(lc,my_friend); /* add my friend to the buddy list, initiate SUBSCRIBE message*/
|
||||
|
||||
}
|
||||
|
||||
linphone_core_set_presence_info(lc,0,NULL,LinphoneStatusOnline); /*set my status to online*/
|
||||
|
||||
/* main loop for receiving notifications and doing background linphone core work: */
|
||||
while(running){
|
||||
linphone_core_iterate(lc); /* first iterate initiates subscription */
|
||||
ms_usleep(50000);
|
||||
}
|
||||
|
||||
linphone_core_set_presence_info(lc,0,NULL,LinphoneStatusOffline); /* change my presence status to offline*/
|
||||
linphone_core_iterate(lc); /* just to make sure new status is initiate message is issued */
|
||||
|
||||
linphone_friend_edit(my_friend); /* start editing friend */
|
||||
linphone_friend_enable_subscribes(my_friend,FALSE); /*disable subscription for this friend*/
|
||||
linphone_friend_done(my_friend); /*commit changes triggering an UNSUBSCRIBE message*/
|
||||
|
||||
linphone_core_iterate(lc); /* just to make sure unsubscribe message is issued */
|
||||
|
||||
end:
|
||||
printf("Shutting down...\n");
|
||||
linphone_core_destroy(lc);
|
||||
printf("Exited\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
100
coreapi/help/chatroom.c
Normal file
100
coreapi/help/chatroom.c
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
|
||||
/*
|
||||
linphone
|
||||
Copyright (C) 2010 Belledonne Communications SARL
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup chatroom_tuto Chat room and messaging
|
||||
* @ingroup tutorials
|
||||
*This program is a _very_ simple usage example of liblinphone,
|
||||
*desmonstrating how to send/receive SIP MESSAGE from a sip uri identity passed from the command line.
|
||||
*<br>Argument must be like sip:jehan@sip.linphone.org .
|
||||
*<br>
|
||||
*ex chatroom sip:jehan@sip.linphone.org
|
||||
*<br>
|
||||
*@include chatroom.c
|
||||
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef IN_LINPHONE
|
||||
#include "linphonecore.h"
|
||||
#else
|
||||
#include "linphone/linphonecore.h"
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
static bool_t running=TRUE;
|
||||
|
||||
static void stop(int signum){
|
||||
running=FALSE;
|
||||
}
|
||||
void text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message) {
|
||||
printf(" Message [%s] received from [%s] \n",message,linphone_address_as_string (from));
|
||||
}
|
||||
|
||||
|
||||
LinphoneCore *lc;
|
||||
int main(int argc, char *argv[]){
|
||||
LinphoneCoreVTable vtable={0};
|
||||
|
||||
char* dest_friend=NULL;
|
||||
|
||||
|
||||
/* takes sip uri identity from the command line arguments */
|
||||
if (argc>1){
|
||||
dest_friend=argv[1];
|
||||
}
|
||||
|
||||
signal(SIGINT,stop);
|
||||
//#define DEBUG
|
||||
#ifdef DEBUG
|
||||
linphone_core_enable_logs(NULL); /*enable liblinphone logs.*/
|
||||
#endif
|
||||
/*
|
||||
Fill the LinphoneCoreVTable with application callbacks.
|
||||
All are optional. Here we only use the text_received callback
|
||||
in order to get notifications about incoming message.
|
||||
*/
|
||||
vtable.text_received=text_received;
|
||||
|
||||
/*
|
||||
Instantiate a LinphoneCore object given the LinphoneCoreVTable
|
||||
*/
|
||||
lc=linphone_core_new(&vtable,NULL,NULL,NULL);
|
||||
|
||||
|
||||
/*Next step is to create a chat root*/
|
||||
LinphoneChatRoom* chat_room = linphone_core_create_chat_room(lc,dest_friend);
|
||||
|
||||
linphone_chat_room_send_message(chat_room,"Hello world"); /*sending message*/
|
||||
|
||||
/* main loop for receiving incoming messages and doing background linphone core work: */
|
||||
while(running){
|
||||
linphone_core_iterate(lc);
|
||||
ms_usleep(50000);
|
||||
}
|
||||
|
||||
printf("Shutting down...\n");
|
||||
linphone_chat_room_destroy(chat_room);
|
||||
linphone_core_destroy(lc);
|
||||
printf("Exited\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
193
coreapi/help/doxygen.dox
Normal file
193
coreapi/help/doxygen.dox
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
/**
|
||||
* @mainpage
|
||||
*
|
||||
* @see http://www.linphone.org
|
||||
*
|
||||
* @section what_is_it What is liblinphone
|
||||
*
|
||||
* Liblinphone is a high level library for bringing SIP video call functionnality
|
||||
* into an application. It aims at making easy the integration of the SIP
|
||||
* video calls into any applications. All variants of linphone are directly based
|
||||
* on it:
|
||||
* - linphone (gtk interface)
|
||||
*
|
||||
* - linphonec (console interface)
|
||||
*
|
||||
* Liblinphone is GPL (see COPYING file). Please understand the licencing details
|
||||
* before using it!
|
||||
*
|
||||
* For any use of this library beyond the rights granted to you by the
|
||||
* GPL license, please contact Belledonne Communications
|
||||
* (contact@belledonne-communications.com)
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* @page liblinphone_license COPYING
|
||||
* @verbinclude COPYING
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup initializing Initializing liblinphone
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup call_control Placing and receiving calls
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup media_parameters Controlling media parameters
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup proxies Managing proxies
|
||||
*User registration is controled by #LinphoneProxyConfig settings.<br> Each #LinphoneProxyConfig object can be configured with registration informations
|
||||
*like \link linphone_proxy_config_set_server_addr() proxy address \endlink , \link linphone_proxy_config_set_identity() user id \endlink, \link linphone_proxy_config_expires() refresh period \endlink, and so on.
|
||||
*<br> A created proxy config using linphone_proxy_config_new(), once configured, must be added to #LinphoneCore using function linphone_core_add_proxy_config().
|
||||
*<br> It is recommended to set a default \link #LinphoneProxyConfig proxy config \endlink using function linphone_core_set_default_proxy(). Once done, if \link #LinphoneProxyConfig a proxy config \endlink has been configured with attribute \link linphone_proxy_config_enable_register() enable register \endlink , next call to linphone_core_iterate() triggers a SIP register.
|
||||
*<br> Registration status is reported by #LinphoneRegistrationStateCb.
|
||||
*<br>
|
||||
*<br> This pseudo code demonstrates basic registration operations:
|
||||
*<br> \code
|
||||
*
|
||||
* LinphoneProxyConfig* proxy_cfg;
|
||||
* /*create proxy config*/
|
||||
* proxy_cfg = linphone_proxy_config_new();
|
||||
* /*parse identity*/
|
||||
* LinphoneAddress *from = linphone_address_new("sip:toto@sip.titi.com");
|
||||
* LinphoneAuthInfo *info;
|
||||
* if (password!=NULL){
|
||||
* info=linphone_auth_info_new(linphone_address_get_username(from),NULL,"secret",NULL,NULL); /*create authentication structure from identity*/
|
||||
* linphone_core_add_auth_info(lc,info); /*add authentication info to LinphoneCore*/
|
||||
* }
|
||||
* // configure proxy entries
|
||||
* linphone_proxy_config_set_identity(proxy_cfg,identity); /*set identity with user name and domain*/
|
||||
* const char* server_addr = linphone_address_get_domain(from); /*extract domain address from identity*/
|
||||
* linphone_proxy_config_set_server_addr(proxy_cfg,server_addr); /* we assume domain = proxy server address*/
|
||||
* linphone_proxy_config_enable_register(proxy_cfg,TRUE); /*activate registration for this proxy config*/
|
||||
* linphone_address_destroy(from); /*release resource*/
|
||||
*
|
||||
* linphone_core_add_proxy_config(lc,proxy_cfg); /*add proxy config to linphone core*/
|
||||
* linphone_core_set_default_proxy(lc,proxy_cfg); /*set to default proxy*/ \endcode
|
||||
*<br>
|
||||
* Registration sate call back:
|
||||
\code
|
||||
static void registration_state_changed(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message){
|
||||
printf("New registration state %s for user id [%s] at proxy [%s]\n"
|
||||
,linphone_registration_state_to_string(cstate)
|
||||
,linphone_proxy_config_get_identity(cfg)
|
||||
,linphone_proxy_config_get_addr(cfg));
|
||||
}
|
||||
\endcode
|
||||
*<br><b>Authentication:</b>
|
||||
*<br>Most of the time, registration requires \ref authentication "authentication" to succed. #LinphoneAuthInfo info must be either added to #LinphoneCore using function linphone_core_add_auth_info() before #LinphoneProxyConfig is added to Linphone core, or on demand from call back #AuthInfoRequested .
|
||||
*<br>
|
||||
*<br><b>Unregistration:</b>
|
||||
*<br> Unregistration or any changes to #LinphoneProxyConfig must be first started by a call to function linphone_proxy_config_edit() and validated by function linphone_proxy_config_done()
|
||||
*<br> This pseudo code shows how to unregister a user associated to a #LinphoneProxyConfig
|
||||
*\code
|
||||
LinphoneProxyConfig* proxy_cfg;
|
||||
linphone_core_get_default_proxy(lc,&proxy_cfg); /* get default proxy config*/
|
||||
linphone_proxy_config_edit(proxy_cfg); /*start editing proxy configuration*/
|
||||
linphone_proxy_config_enable_register(proxy_cfg,FALSE); /*de-activate registration for this proxy config*/
|
||||
linphone_proxy_config_done(proxy_cfg); /*initiate REGISTER with expire = 0*/
|
||||
\endcode
|
||||
<br>
|
||||
A complete tutorial can be found at : \ref registration_tutorials "Registration tutorial"
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup network_parameters Controlling network parameters (ports, mtu...)
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup authentication Managing authentication: userid and passwords
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup buddy_list Managing Buddies and buddy list and presence
|
||||
<b>Buddies and buddy list</b>
|
||||
<br>Each buddy is represented by a #LinphoneFriend object created by function linphone_friend_new().
|
||||
Buddy configuration parameters like \link linphone_friend_set_addr() sip uri \endlink or \link linphone_friend_set_inc_subscribe_policy() status publication \endlink policy for this \link #LinphoneFriend friend \endlink are configurable for each buddy.
|
||||
<br>Here under a typical buddy creation:
|
||||
<br>
|
||||
\code
|
||||
LinphoneFriend* my_friend=linphone_friend_new_with_addr("sip:joe@sip.linphone.org"); /*creates friend object for buddy joe*/
|
||||
linphone_friend_enable_subscribes(my_friend,TRUE); /*configure this friend to emit SUBSCRIBE message after being added to LinphoneCore*/
|
||||
linphone_friend_set_inc_subscribe_policy(my_friend,LinphoneSPAccept); /* accept Incoming subscription request for this friend*/
|
||||
\endcode
|
||||
\link #LinphoneFriend friends \endlink status changes are reported by callback LinphoneCoreVTable.notify_presence_recv
|
||||
\code
|
||||
static void notify_presence_recv_updated (struct _LinphoneCore *lc, LinphoneFriend *friend) {
|
||||
const LinphoneAddress* friend_address = linphone_friend_get_address(friend);
|
||||
printf("New state state [%s] for user id [%s] \n"
|
||||
,linphone_online_status_to_string(linphone_friend_get_status(friend))
|
||||
,linphone_address_as_string (friend_address));
|
||||
}
|
||||
\endcode
|
||||
<br>Once created a buddy can be added to the buddy list using function linphone_core_add_friend() . Added friends will be notified about \link linphone_core_set_presence_info() local status changes \endlink
|
||||
<br>
|
||||
Any subsequente modifications to #LinphoneFriend must be first started by a call to function linphone_friend_edit() and validated by function linphone_friend_done()
|
||||
\code
|
||||
linphone_friend_edit(my_friend); /* start editing friend */
|
||||
linphone_friend_enable_subscribes(my_friend,FALSE); /*disable subscription for this friend*/
|
||||
linphone_friend_done(my_friend); /*commit changes triggering an UNSUBSCRIBE message*/
|
||||
\endcode
|
||||
|
||||
|
||||
<b> Publishing presence status </b>
|
||||
<br>Local presence status can be changed using function linphone_core_set_presence_info() .New status is propagated to all friends \link linphone_core_add_friend() previously added \endlink to #LinphoneCore.
|
||||
|
||||
<b>Handling incoming subscription request</b>
|
||||
<br> New incoming subscription requests are process according to \link linphone_friend_set_inc_subscribe_policy() the incoming subscription policy state \endlink for subscription initiated by \link linphone_core_add_friend() members of the buddy list. \endlink
|
||||
<br> For incoming request comming from an unknown buddy, the call back LinphoneCoreVTable.new_subscription_request is invoked.
|
||||
|
||||
<br> A complete tutorial can be found at : \ref buddy_tutorials "Registration tutorial"
|
||||
|
||||
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup chatroom Chat room and Messaging
|
||||
<b> Exchanging text messages</b>
|
||||
<br> Messages are sent using #LinphoneChatRoom object. First step is to create a \link linphone_core_create_chat_room() chat room \endlink
|
||||
from a peer sip uri.
|
||||
\code
|
||||
LinphoneChatRoom* chat_room = linphone_core_create_chat_room(lc,"sip:joe@sip.linphone.org");
|
||||
\endcode
|
||||
|
||||
<br>Once created, messages are sent using function linphone_chat_room_send_message() .
|
||||
\code
|
||||
linphone_chat_room_send_message(chat_room,"Hello world"); /*sending message*/
|
||||
\endcode
|
||||
<br>Incoming message are received from call back LinphoneCoreVTable.text_received
|
||||
\code
|
||||
void text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message) {
|
||||
printf(" Message [%s] received from [%s] \n",message,linphone_address_as_string (from));
|
||||
}
|
||||
\endcode
|
||||
<br> A complete tutorial can be found at : \ref chatroom_tuto "Chat room tutorial"
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup call_logs Managing call logs
|
||||
**/
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup linphone_address SIP address parser API.
|
||||
* This api is useful for manipulating SIP addresses ('from' or 'to' headers).
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup misc Miscenalleous: logs, version strings, config storage
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup tutorials Tutorials:
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
/**
|
||||
* @mainpage
|
||||
*
|
||||
* @see http://www.linphone.org
|
||||
*
|
||||
* @section what_is_it What is liblinphone
|
||||
*
|
||||
* Liblinphone is a high level library for bringing SIP video call functionnality
|
||||
* into an application. It aims at making easy the integration of the SIP
|
||||
* video calls into any applications. All variants of linphone are directly based
|
||||
* on it:
|
||||
* - linphone (gtk interface)
|
||||
*
|
||||
* - linphonec (console interface)
|
||||
*
|
||||
* Liblinphone is GPL (see COPYING file). Please understand the licencing details
|
||||
* before using it!
|
||||
*
|
||||
* For any use of this library beyond the rights granted to you by the
|
||||
* GPL license, please contact Belledonne Communications
|
||||
* (contact@belledonne-communications.com)
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* @page liblinphone_license COPYING
|
||||
* @verbinclude COPYING
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup initializing Initializing liblinphone
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup call_control Placing and receiving calls
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup media_parameters Controlling media parameters
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup proxies Managing proxies
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup network_parameters Controlling network parameters (ports, mtu...)
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup authentication Managing authentication: userid and passwords
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup call_logs Managing call logs
|
||||
**/
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup linphone_address SIP address parser API.
|
||||
* This api is useful for manipulating SIP addresses ('from' or 'to' headers).
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup misc Miscenalleous: logs, version strings, config storage
|
||||
**/
|
||||
|
||||
/**
|
||||
* @defgroup tutorial_liblinphone Tutorial: Placing calls with liblinphone
|
||||
*
|
||||
* The minimalist program below illustrates how to initialize liblinphone and place and outgoing call.
|
||||
* @include helloworld.c
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
|
||||
|
|
@ -19,12 +19,19 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
/**
|
||||
* @defgroup basic_call_tutorials Basic call
|
||||
* @ingroup tutorials
|
||||
This program is a _very_ simple usage example of liblinphone.
|
||||
It just takes a sip-uri as first argument and attempts to call it
|
||||
*/
|
||||
|
||||
#include <linphonecore.h>
|
||||
@include helloworld.c
|
||||
*/
|
||||
#ifdef IN_LINPHONE
|
||||
#include "linphonecore.h"
|
||||
#else
|
||||
#include "linphone/linphonecore.h"
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
|
|
@ -74,7 +81,10 @@ int main(int argc, char *argv[]){
|
|||
}
|
||||
|
||||
signal(SIGINT,stop);
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
linphone_core_enable_logs(NULL); /*enable liblinphone logs.*/
|
||||
#endif
|
||||
/*
|
||||
Fill the LinphoneCoreVTable with application callbacks.
|
||||
All are optional. Here we only use the call_state_changed callbacks
|
||||
|
|
|
|||
|
|
@ -0,0 +1,194 @@
|
|||
/*
|
||||
TutorialBuddyStatus
|
||||
Copyright (C) 2010 Belledonne Communications SARL
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core.tutorials;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreListener;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.OnlineStatus;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCore.GlobalState;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
import org.linphone.core.LinphoneFriend.SubscribePolicy;
|
||||
|
||||
/**
|
||||
*
|
||||
* This program is a _very_ simple usage example of liblinphone,
|
||||
* demonstrating how to initiate SIP subscriptions and receive notifications
|
||||
* from a sip uri identity passed from the command line.
|
||||
* <br>Argument must be like sip:jehan@sip.linphone.org .
|
||||
* ex budy_list sip:jehan@sip.linphone.org
|
||||
* <br>Subscription is cleared on SIGINT
|
||||
*
|
||||
* Ported from buddy_status.c
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class TutorialBuddyStatus implements LinphoneCoreListener {
|
||||
|
||||
private boolean running;
|
||||
private TutorialNotifier TutorialNotifier;
|
||||
|
||||
|
||||
public TutorialBuddyStatus(TutorialNotifier TutorialNotifier) {
|
||||
this.TutorialNotifier = TutorialNotifier;
|
||||
}
|
||||
|
||||
public TutorialBuddyStatus() {
|
||||
this.TutorialNotifier = new TutorialNotifier();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,String url) {
|
||||
write("["+lf.getAddress().getUserName()+"] wants to see your status, accepting");
|
||||
lf.edit(); // start editing friend
|
||||
lf.setIncSubscribePolicy(SubscribePolicy.SPAccept); // accept incoming subscription request for this friend
|
||||
lf.done(); // commit change
|
||||
try {
|
||||
// add this new friend to the buddy list
|
||||
lc.addFriend(lf);
|
||||
} catch (LinphoneCoreException e) {
|
||||
write("Error while adding friend [" + lf.getAddress().getUserName() + "] to linphone in the callback");
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {
|
||||
write("New state [" + lf.getStatus() +"] for user id ["+lf.getAddress().getUserName()+"]");
|
||||
}
|
||||
|
||||
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg,RegistrationState cstate, String smessage) {}
|
||||
public void show(LinphoneCore lc) {}
|
||||
public void byeReceived(LinphoneCore lc, String from) {}
|
||||
public void authInfoRequested(LinphoneCore lc, String realm, String username) {}
|
||||
public void displayStatus(LinphoneCore lc, String message) {}
|
||||
public void displayMessage(LinphoneCore lc, String message) {}
|
||||
public void displayWarning(LinphoneCore lc, String message) {}
|
||||
public void globalState(LinphoneCore lc, GlobalState state, String message) {}
|
||||
public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {}
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg) {}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Check tutorial was called with the right number of arguments
|
||||
if (args.length != 1) {
|
||||
throw new IllegalArgumentException("Bad number of arguments");
|
||||
}
|
||||
|
||||
// Create tutorial object
|
||||
TutorialBuddyStatus tutorial = new TutorialBuddyStatus();
|
||||
try {
|
||||
// takes sip uri identity from the command line arguments
|
||||
String userSipAddress = args[1];
|
||||
tutorial.launchTutorial(userSipAddress);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void launchTutorial(String sipAddress) throws LinphoneCoreException {
|
||||
final LinphoneCoreFactory lcFactory = LinphoneCoreFactory.instance();
|
||||
|
||||
// First instantiate the core Linphone object given only a listener.
|
||||
// The listener will react to events in Linphone core.
|
||||
LinphoneCore lc = lcFactory.createLinphoneCore(this);
|
||||
|
||||
|
||||
try {
|
||||
|
||||
// Create friend object from string address
|
||||
LinphoneFriend lf = lcFactory.createLinphoneFriend(sipAddress);
|
||||
if (lf == null) {
|
||||
write("Could not create friend; weird SIP address?");
|
||||
return;
|
||||
}
|
||||
|
||||
// configure this friend to emit SUBSCRIBE message after being added to LinphoneCore
|
||||
lf.enableSubscribes(true);
|
||||
|
||||
// accept incoming subscription request for this friend
|
||||
lf.setIncSubscribePolicy(SubscribePolicy.SPAccept);
|
||||
try {
|
||||
// add my friend to the buddy list, initiate SUBSCRIBE message
|
||||
lc.addFriend(lf);
|
||||
} catch (LinphoneCoreException e) {
|
||||
write("Error while adding friend " + lf.getAddress().getUserName() + " to linphone");
|
||||
return;
|
||||
}
|
||||
|
||||
// set my status to online
|
||||
lc.setPresenceInfo(0, null, OnlineStatus.Online);
|
||||
|
||||
|
||||
// main loop for receiving notifications and doing background linphonecore work
|
||||
running = true;
|
||||
while (running) {
|
||||
lc.iterate(); // first iterate initiates subscription
|
||||
try{
|
||||
Thread.sleep(50);
|
||||
} catch(InterruptedException ie) {
|
||||
write("Interrupted!\nAborting");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// change my presence status to offline
|
||||
lc.setPresenceInfo(0, null, OnlineStatus.Offline);
|
||||
// just to make sure new status is initiate message is issued
|
||||
lc.iterate();
|
||||
|
||||
|
||||
lf.edit(); // start editing friend
|
||||
lf.enableSubscribes(false); // disable subscription for this friend
|
||||
lf.done(); // commit changes triggering an UNSUBSCRIBE message
|
||||
lc.iterate(); // just to make sure unsubscribe message is issued
|
||||
|
||||
|
||||
} finally {
|
||||
write("Shutting down...");
|
||||
// You need to destroy the LinphoneCore object when no longer used
|
||||
lc.destroy();
|
||||
write("Exited");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void stopMainLoop() {
|
||||
running=false;
|
||||
}
|
||||
|
||||
|
||||
private void write(String s) {
|
||||
TutorialNotifier.notify(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
TutorialChatRoom.java
|
||||
Copyright (C) 2010 Belledonne Communications SARL
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core.tutorials;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreListener;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCore.GlobalState;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
|
||||
|
||||
/**
|
||||
* This program is a _very_ simple usage example of liblinphone.
|
||||
* It demonstrates how to send/receive SIP MESSAGE from a sip uri identity
|
||||
* passed from the command line.
|
||||
*
|
||||
* Argument must be like sip:jehan@sip.linphone.org .
|
||||
*
|
||||
* ex chatroom sip:jehan@sip.linphone.org
|
||||
* just takes a sip-uri as first argument and attempts to call it.
|
||||
*
|
||||
* Ported from chatroom.c
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class TutorialChatRoom implements LinphoneCoreListener {
|
||||
private boolean running;
|
||||
private TutorialNotifier TutorialNotifier;
|
||||
|
||||
|
||||
public TutorialChatRoom(TutorialNotifier TutorialNotifier) {
|
||||
this.TutorialNotifier = TutorialNotifier;
|
||||
}
|
||||
|
||||
public TutorialChatRoom() {
|
||||
this.TutorialNotifier = new TutorialNotifier();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void show(LinphoneCore lc) {}
|
||||
public void byeReceived(LinphoneCore lc, String from) {}
|
||||
public void authInfoRequested(LinphoneCore lc, String realm, String username) {}
|
||||
public void displayStatus(LinphoneCore lc, String message) {}
|
||||
public void displayMessage(LinphoneCore lc, String message) {}
|
||||
public void displayWarning(LinphoneCore lc, String message) {}
|
||||
public void globalState(LinphoneCore lc, GlobalState state, String message) {}
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg,RegistrationState cstate, String smessage) {}
|
||||
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,String url) {}
|
||||
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {}
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg){}
|
||||
|
||||
|
||||
|
||||
public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {
|
||||
write("Message ["+message+"] received from ["+from.asString()+"]");
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Check tutorial was called with the right number of arguments
|
||||
// Takes the sip uri identity from the command line arguments
|
||||
if (args.length != 1) {
|
||||
throw new IllegalArgumentException("Bad number of arguments");
|
||||
}
|
||||
|
||||
// Create tutorial object
|
||||
TutorialChatRoom tutorial = new TutorialChatRoom();
|
||||
try {
|
||||
String destinationSipAddress = args[1];
|
||||
tutorial.launchTutorial(destinationSipAddress);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void launchTutorial(String destinationSipAddress) throws LinphoneCoreException {
|
||||
|
||||
// First instantiate the core Linphone object given only a listener.
|
||||
// The listener will react to events in Linphone core.
|
||||
LinphoneCore lc = LinphoneCoreFactory.instance().createLinphoneCore(this);
|
||||
|
||||
try {
|
||||
// Next step is to create a chat room
|
||||
LinphoneChatRoom chatRoom = lc.createChatRoom(destinationSipAddress);
|
||||
|
||||
// Send message
|
||||
chatRoom.sendMessage("Hello world");
|
||||
|
||||
// main loop for receiving notifications and doing background linphonecore work
|
||||
running = true;
|
||||
while (running) {
|
||||
lc.iterate();
|
||||
try{
|
||||
Thread.sleep(50);
|
||||
} catch(InterruptedException ie) {
|
||||
write("Interrupted!\nAborting");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
} finally {
|
||||
write("Shutting down...");
|
||||
// You need to destroy the LinphoneCore object when no longer used
|
||||
lc.destroy();
|
||||
write("Exited");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void stopMainLoop() {
|
||||
running=false;
|
||||
}
|
||||
|
||||
|
||||
private void write(String s) {
|
||||
TutorialNotifier.notify(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
/*
|
||||
TutorialHelloWorld.java
|
||||
Copyright (C) 2010 Belledonne Communications SARL
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core.tutorials;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreListener;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCore.GlobalState;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
|
||||
|
||||
/**
|
||||
* This program is a _very_ simple usage example of liblinphone.
|
||||
* It just takes a sip-uri as first argument and attempts to call it.
|
||||
*
|
||||
* Ported from helloworld.c
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class TutorialHelloWorld implements LinphoneCoreListener {
|
||||
private boolean running;
|
||||
private TutorialNotifier TutorialNotifier;
|
||||
|
||||
|
||||
public TutorialHelloWorld(TutorialNotifier TutorialNotifier) {
|
||||
this.TutorialNotifier = TutorialNotifier;
|
||||
}
|
||||
|
||||
public TutorialHelloWorld() {
|
||||
this.TutorialNotifier = new TutorialNotifier();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void show(LinphoneCore lc) {}
|
||||
public void byeReceived(LinphoneCore lc, String from) {}
|
||||
public void authInfoRequested(LinphoneCore lc, String realm, String username) {}
|
||||
public void displayStatus(LinphoneCore lc, String message) {}
|
||||
public void displayMessage(LinphoneCore lc, String message) {}
|
||||
public void displayWarning(LinphoneCore lc, String message) {}
|
||||
public void globalState(LinphoneCore lc, GlobalState state, String message) {}
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg,RegistrationState cstate, String smessage) {}
|
||||
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,String url) {}
|
||||
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {}
|
||||
public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {}
|
||||
|
||||
/*
|
||||
* Call state notification listener
|
||||
*/
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg){
|
||||
write("State: " + msg);
|
||||
|
||||
if (State.CallEnd.equals(cstate))
|
||||
running = false;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Check tutorial was called with the right number of arguments
|
||||
if (args.length != 1) {
|
||||
throw new IllegalArgumentException("Bad number of arguments");
|
||||
}
|
||||
|
||||
// Create tutorial object
|
||||
TutorialHelloWorld helloWorld = new TutorialHelloWorld();
|
||||
try {
|
||||
String destinationSipAddress = args[1];
|
||||
helloWorld.launchTutorial(destinationSipAddress);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void launchTutorial(String destinationSipAddress) throws LinphoneCoreException {
|
||||
|
||||
// First instantiate the core Linphone object given only a listener.
|
||||
// The listener will react to events in Linphone core.
|
||||
LinphoneCore lc = LinphoneCoreFactory.instance().createLinphoneCore(this);
|
||||
|
||||
|
||||
|
||||
try {
|
||||
// Send the INVITE message to destination SIP address
|
||||
LinphoneCall call = lc.invite(destinationSipAddress);
|
||||
if (call == null) {
|
||||
write("Could not place call to " + destinationSipAddress);
|
||||
write("Aborting");
|
||||
return;
|
||||
}
|
||||
write("Call to " + destinationSipAddress + " is in progress...");
|
||||
|
||||
|
||||
|
||||
// main loop for receiving notifications and doing background linphonecore work
|
||||
running = true;
|
||||
while (running) {
|
||||
lc.iterate();
|
||||
try{
|
||||
Thread.sleep(50);
|
||||
} catch(InterruptedException ie) {
|
||||
write("Interrupted!\nAborting");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!State.CallEnd.equals(call.getState())) {
|
||||
write("Terminating the call");
|
||||
lc.terminateCall(call);
|
||||
}
|
||||
} finally {
|
||||
write("Shutting down...");
|
||||
// You need to destroy the LinphoneCore object when no longer used
|
||||
lc.destroy();
|
||||
write("Exited");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void stopMainLoop() {
|
||||
running=false;
|
||||
}
|
||||
|
||||
|
||||
private void write(String s) {
|
||||
TutorialNotifier.notify(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
TutorialNotifier.java
|
||||
Copyright (C) 2010 Belledonne Communications SARL
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core.tutorials;
|
||||
|
||||
/**
|
||||
* Notify to the standard output.
|
||||
* Subclass to define another text output.
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class TutorialNotifier {
|
||||
|
||||
public void notify(String s) {
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
/*
|
||||
TutorialRegistration.java
|
||||
Copyright (C) 2010 Belledonne Communications SARL
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core.tutorials;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreListener;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCore.GlobalState;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
|
||||
|
||||
/**
|
||||
* This program is a _very_ simple usage example of liblinphone.
|
||||
* Demonstrating how to initiate a SIP registration from a sip uri identity
|
||||
* passed from the command line.
|
||||
*
|
||||
* First argument must be like sip:jehan@sip.linphone.org, second must be password.
|
||||
* <br>
|
||||
* ex registration sip:jehan@sip.linphone.org secret
|
||||
*
|
||||
* Ported from registration.c
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class TutorialRegistration implements LinphoneCoreListener {
|
||||
private boolean running;
|
||||
private TutorialNotifier TutorialNotifier;
|
||||
|
||||
|
||||
public TutorialRegistration(TutorialNotifier TutorialNotifier) {
|
||||
this.TutorialNotifier = TutorialNotifier;
|
||||
}
|
||||
|
||||
public TutorialRegistration() {
|
||||
this.TutorialNotifier = new TutorialNotifier();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Registration state notification listener
|
||||
*/
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg,RegistrationState cstate, String smessage) {
|
||||
write(cfg.getIdentity() + " : "+smessage+"\n");
|
||||
|
||||
if (RegistrationState.RegistrationOk.equals(cstate))
|
||||
running = false;
|
||||
}
|
||||
|
||||
public void show(LinphoneCore lc) {}
|
||||
public void byeReceived(LinphoneCore lc, String from) {}
|
||||
public void authInfoRequested(LinphoneCore lc, String realm, String username) {}
|
||||
public void displayStatus(LinphoneCore lc, String message) {}
|
||||
public void displayMessage(LinphoneCore lc, String message) {}
|
||||
public void displayWarning(LinphoneCore lc, String message) {}
|
||||
public void globalState(LinphoneCore lc, GlobalState state, String message) {}
|
||||
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,String url) {}
|
||||
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {}
|
||||
public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {}
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg) {}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Check tutorial was called with the right number of arguments
|
||||
if (args.length != 2) {
|
||||
throw new IllegalArgumentException("Bad number of arguments");
|
||||
}
|
||||
|
||||
// Create tutorial object
|
||||
TutorialRegistration tutorial = new TutorialRegistration();
|
||||
try {
|
||||
// takes sip uri identity from the command line arguments
|
||||
String userSipAddress = args[1];
|
||||
// takes password from the command line arguments
|
||||
String userSipPassword = args[2];
|
||||
tutorial.launchTutorial(userSipAddress, userSipPassword);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void launchTutorial(String sipAddress, String password) throws LinphoneCoreException {
|
||||
final LinphoneCoreFactory lcFactory = LinphoneCoreFactory.instance();
|
||||
|
||||
// First instantiate the core Linphone object given only a listener.
|
||||
// The listener will react to events in Linphone core.
|
||||
LinphoneCore lc = lcFactory.createLinphoneCore(this);
|
||||
|
||||
|
||||
try {
|
||||
|
||||
// Parse identity
|
||||
LinphoneAddress address = lcFactory.createLinphoneAddress(sipAddress);
|
||||
String username = address.getUserName();
|
||||
String domain = address.getDomain();
|
||||
|
||||
|
||||
if (password != null) {
|
||||
// create authentication structure from identity and add to linphone
|
||||
lc.addAuthInfo(lcFactory.createAuthInfo(username, password, null));
|
||||
}
|
||||
|
||||
// create proxy config
|
||||
LinphoneProxyConfig proxyCfg = lcFactory.createProxyConfig(sipAddress, domain, null, true);
|
||||
lc.addProxyConfig(proxyCfg); // add it to linphone
|
||||
lc.setDefaultProxyConfig(proxyCfg);
|
||||
|
||||
|
||||
|
||||
|
||||
// main loop for receiving notifications and doing background linphonecore work
|
||||
running = true;
|
||||
while (running) {
|
||||
lc.iterate(); // first iterate initiates registration
|
||||
try{
|
||||
Thread.sleep(50);
|
||||
} catch(InterruptedException ie) {
|
||||
write("Interrupted!\nAborting");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Automatic unregistration on exit
|
||||
|
||||
|
||||
} finally {
|
||||
write("Shutting down...");
|
||||
// You need to destroy the LinphoneCore object when no longer used
|
||||
lc.destroy();
|
||||
write("Exited");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void stopMainLoop() {
|
||||
running=false;
|
||||
}
|
||||
|
||||
|
||||
private void write(String s) {
|
||||
TutorialNotifier.notify(s);
|
||||
}
|
||||
|
||||
}
|
||||
142
coreapi/help/registration.c
Normal file
142
coreapi/help/registration.c
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
|
||||
/*
|
||||
linphone
|
||||
Copyright (C) 2010 Belledonne Communications SARL
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup registration_tutorials Basic registration
|
||||
* @ingroup tutorials
|
||||
*This program is a _very_ simple usage example of liblinphone.
|
||||
*Desmonstrating how to initiate a SIP registration from a sip uri identity passed from the command line.
|
||||
*first argument must be like sip:jehan@sip.linphone.org , second must be password .
|
||||
*<br>
|
||||
*ex registration sip:jehan@sip.linphone.org secret
|
||||
*<br>Registration is cleared on SIGINT
|
||||
*<br>
|
||||
*@include registration.c
|
||||
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef IN_LINPHONE
|
||||
#include "linphonecore.h"
|
||||
#else
|
||||
#include "linphone/linphonecore.h"
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
static bool_t running=TRUE;
|
||||
|
||||
static void stop(int signum){
|
||||
running=FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration state notification callback
|
||||
*/
|
||||
static void registration_state_changed(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message){
|
||||
printf("New registration state %s for user id [%s] at proxy [%s]\n"
|
||||
,linphone_registration_state_to_string(cstate)
|
||||
,linphone_proxy_config_get_identity(cfg)
|
||||
,linphone_proxy_config_get_addr(cfg));
|
||||
}
|
||||
|
||||
LinphoneCore *lc;
|
||||
int main(int argc, char *argv[]){
|
||||
LinphoneCoreVTable vtable={0};
|
||||
|
||||
char* identity=NULL;
|
||||
char* password=NULL;
|
||||
|
||||
/* takes sip uri identity from the command line arguments */
|
||||
if (argc>1){
|
||||
identity=argv[1];
|
||||
}
|
||||
|
||||
/* takes password from the command line arguments */
|
||||
if (argc>2){
|
||||
password=argv[2];
|
||||
}
|
||||
|
||||
signal(SIGINT,stop);
|
||||
|
||||
#ifdef DEBUG
|
||||
linphone_core_enable_logs(NULL); /*enable liblinphone logs.*/
|
||||
#endif
|
||||
/*
|
||||
Fill the LinphoneCoreVTable with application callbacks.
|
||||
All are optional. Here we only use the registration_state_changed callbacks
|
||||
in order to get notifications about the progress of the registration.
|
||||
*/
|
||||
vtable.registration_state_changed=registration_state_changed;
|
||||
|
||||
/*
|
||||
Instanciate a LinphoneCore object given the LinphoneCoreVTable
|
||||
*/
|
||||
lc=linphone_core_new(&vtable,NULL,NULL,NULL);
|
||||
|
||||
LinphoneProxyConfig* proxy_cfg;
|
||||
/*create proxy config*/
|
||||
proxy_cfg = linphone_proxy_config_new();
|
||||
/*parse identity*/
|
||||
LinphoneAddress *from = linphone_address_new(identity);
|
||||
if (from==NULL){
|
||||
printf("%s not a valid sip uri, must be like sip:toto@sip.linphone.org \n",identity);
|
||||
goto end;
|
||||
}
|
||||
LinphoneAuthInfo *info;
|
||||
if (password!=NULL){
|
||||
info=linphone_auth_info_new(linphone_address_get_username(from),NULL,password,NULL,NULL); /*create authentication structure from identity*/
|
||||
linphone_core_add_auth_info(lc,info); /*add authentication info to LinphoneCore*/
|
||||
}
|
||||
|
||||
// configure proxy entries
|
||||
linphone_proxy_config_set_identity(proxy_cfg,identity); /*set identity with user name and domain*/
|
||||
const char* server_addr = linphone_address_get_domain(from); /*extract domain address from identity*/
|
||||
linphone_proxy_config_set_server_addr(proxy_cfg,server_addr); /* we assume domain = proxy server address*/
|
||||
linphone_proxy_config_enable_register(proxy_cfg,TRUE); /*activate registration for this proxy config*/
|
||||
linphone_address_destroy(from); /*release resource*/
|
||||
|
||||
linphone_core_add_proxy_config(lc,proxy_cfg); /*add proxy config to linphone core*/
|
||||
linphone_core_set_default_proxy(lc,proxy_cfg); /*set to default proxy*/
|
||||
|
||||
|
||||
/* main loop for receiving notifications and doing background linphonecore work: */
|
||||
while(running){
|
||||
linphone_core_iterate(lc); /* first iterate initiates registration */
|
||||
ms_usleep(50000);
|
||||
}
|
||||
|
||||
linphone_core_get_default_proxy(lc,&proxy_cfg); /* get default proxy config*/
|
||||
linphone_proxy_config_edit(proxy_cfg); /*start editing proxy configuration*/
|
||||
linphone_proxy_config_enable_register(proxy_cfg,FALSE); /*de-activate registration for this proxy config*/
|
||||
linphone_proxy_config_done(proxy_cfg); /*initiate REGISTER with expire = 0*/
|
||||
|
||||
while(linphone_proxy_config_get_state(proxy_cfg) != LinphoneRegistrationCleared){
|
||||
linphone_core_iterate(lc); /*to make sure we receive call backs before shutting down*/
|
||||
ms_usleep(50000);
|
||||
}
|
||||
|
||||
end:
|
||||
printf("Shutting down...\n");
|
||||
linphone_core_destroy(lc);
|
||||
printf("Exited\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -30,7 +30,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "mediastreamer2/mediastream.h"
|
||||
#include "mediastreamer2/msvolume.h"
|
||||
#include "mediastreamer2/msequalizer.h"
|
||||
#include "mediastreamer2/msfileplayer.h"
|
||||
#include "mediastreamer2/msjpegwriter.h"
|
||||
|
||||
#ifdef VIDEO_ENABLED
|
||||
static MSWebCam *get_nowebcam_device(){
|
||||
return ms_web_cam_manager_get_cam(ms_web_cam_manager_get(),"StaticImage: Static picture");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static MSList *make_codec_list(LinphoneCore *lc, const MSList *codecs, bool_t only_one_codec){
|
||||
|
|
@ -46,11 +53,15 @@ static MSList *make_codec_list(LinphoneCore *lc, const MSList *codecs, bool_t on
|
|||
return l;
|
||||
}
|
||||
|
||||
static SalMediaDescription *create_local_media_description(LinphoneCore *lc,
|
||||
LinphoneCall *call, const char *username, bool_t only_one_codec){
|
||||
SalMediaDescription *create_local_media_description(LinphoneCore *lc,
|
||||
LinphoneCall *call, bool_t with_video, bool_t only_one_codec){
|
||||
MSList *l;
|
||||
PayloadType *pt;
|
||||
const char *me=linphone_core_get_identity(lc);
|
||||
LinphoneAddress *addr=linphone_address_new(me);
|
||||
const char *username=linphone_address_get_username (addr);
|
||||
SalMediaDescription *md=sal_media_description_new();
|
||||
|
||||
md->nstreams=1;
|
||||
strncpy(md->addr,call->localip,sizeof(md->addr));
|
||||
strncpy(md->username,username,sizeof(md->username));
|
||||
|
|
@ -69,7 +80,7 @@ static SalMediaDescription *create_local_media_description(LinphoneCore *lc,
|
|||
if (lc->dw_audio_bw>0)
|
||||
md->streams[0].bandwidth=lc->dw_audio_bw;
|
||||
|
||||
if (linphone_core_video_enabled (lc)){
|
||||
if (with_video){
|
||||
md->nstreams++;
|
||||
md->streams[1].port=call->video_port;
|
||||
md->streams[1].proto=SalProtoRtpAvp;
|
||||
|
|
@ -79,6 +90,7 @@ static SalMediaDescription *create_local_media_description(LinphoneCore *lc,
|
|||
if (lc->dw_video_bw)
|
||||
md->streams[1].bandwidth=lc->dw_video_bw;
|
||||
}
|
||||
linphone_address_destroy(addr);
|
||||
return md;
|
||||
}
|
||||
|
||||
|
|
@ -134,7 +146,7 @@ static void discover_mtu(LinphoneCore *lc, const char *remote){
|
|||
}
|
||||
}
|
||||
|
||||
LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to)
|
||||
LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params)
|
||||
{
|
||||
LinphoneCall *call=ms_new0(LinphoneCall,1);
|
||||
call->dir=LinphoneCallOutgoing;
|
||||
|
|
@ -143,17 +155,20 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr
|
|||
call->core=lc;
|
||||
linphone_core_get_local_ip(lc,linphone_address_get_domain(to),call->localip);
|
||||
linphone_call_init_common(call,from,to);
|
||||
call->localdesc=create_local_media_description (lc,call,
|
||||
linphone_address_get_username(from),FALSE);
|
||||
call->params=*params;
|
||||
call->localdesc=create_local_media_description (lc,call,params->has_video,FALSE);
|
||||
call->camera_active=params->has_video;
|
||||
if (linphone_core_get_firewall_policy(call->core)==LinphonePolicyUseStun)
|
||||
linphone_core_run_stun_tests(call->core,call);
|
||||
discover_mtu(lc,linphone_address_get_domain (to));
|
||||
if (params->referer){
|
||||
sal_call_set_referer (call->op,params->referer->op);
|
||||
}
|
||||
return call;
|
||||
}
|
||||
|
||||
LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op){
|
||||
LinphoneCall *call=ms_new0(LinphoneCall,1);
|
||||
LinphoneAddress *me=linphone_core_get_primary_contact_parsed(lc);
|
||||
char *to_str;
|
||||
char *from_str;
|
||||
|
||||
|
|
@ -178,12 +193,13 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
|
|||
linphone_address_clean(from);
|
||||
linphone_core_get_local_ip(lc,linphone_address_get_domain(from),call->localip);
|
||||
linphone_call_init_common(call, from, to);
|
||||
call->params.has_video=linphone_core_video_enabled(lc);
|
||||
call->localdesc=create_local_media_description (lc,call,
|
||||
linphone_address_get_username(me),lc->sip_conf.only_one_codec);
|
||||
call->params.has_video,lc->sip_conf.only_one_codec);
|
||||
call->camera_active=call->params.has_video;
|
||||
if (linphone_core_get_firewall_policy(call->core)==LinphonePolicyUseStun)
|
||||
linphone_core_run_stun_tests(call->core,call);
|
||||
discover_mtu(lc,linphone_address_get_domain(from));
|
||||
linphone_address_destroy(me);
|
||||
return call;
|
||||
}
|
||||
|
||||
|
|
@ -200,7 +216,10 @@ static void linphone_call_set_terminated(LinphoneCall *call){
|
|||
|
||||
linphone_core_update_allocated_audio_bandwidth(lc);
|
||||
if (call->state==LinphoneCallEnd){
|
||||
status=LinphoneCallSuccess;
|
||||
if (call->reason==LinphoneReasonDeclined){
|
||||
status=LinphoneCallDeclined;
|
||||
}
|
||||
else status=LinphoneCallSuccess;
|
||||
|
||||
}
|
||||
linphone_call_log_completed(call->log,call, status);
|
||||
|
|
@ -208,7 +227,6 @@ static void linphone_call_set_terminated(LinphoneCall *call){
|
|||
if (call == lc->current_call){
|
||||
ms_message("Resetting the current call");
|
||||
lc->current_call=NULL;
|
||||
linphone_core_start_pending_refered_calls(lc);
|
||||
}
|
||||
|
||||
if (linphone_core_del_call(lc,call) != 0){
|
||||
|
|
@ -254,11 +272,13 @@ const char *linphone_call_state_to_string(LinphoneCallState cs){
|
|||
case LinphoneCallRefered:
|
||||
return "LinphoneCallRefered";
|
||||
case LinphoneCallError:
|
||||
return "LinphoneCallRefered";
|
||||
return "LinphoneCallError";
|
||||
case LinphoneCallEnd:
|
||||
return "LinphoneCallEnd";
|
||||
case LinphoneCallPausedByRemote:
|
||||
return "LinphoneCallPausedByRemote";
|
||||
case LinphoneCallUpdatedByRemote:
|
||||
return "LinphoneCallUpdatedByRemote";
|
||||
}
|
||||
return "undefined state";
|
||||
}
|
||||
|
|
@ -336,6 +356,13 @@ void linphone_call_unref(LinphoneCall *obj){
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current parameters associated to the call.
|
||||
**/
|
||||
const LinphoneCallParams * linphone_call_get_current_params(const LinphoneCall *call){
|
||||
return &call->params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the remote address associated to this call
|
||||
*
|
||||
|
|
@ -360,6 +387,13 @@ LinphoneCallState linphone_call_get_state(const LinphoneCall *call){
|
|||
return call->state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the reason for a call termination (either error or normal termination)
|
||||
**/
|
||||
LinphoneReason linphone_call_get_reason(const LinphoneCall *call){
|
||||
return call->reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user_pointer in the LinphoneCall
|
||||
*
|
||||
|
|
@ -398,10 +432,23 @@ const char *linphone_call_get_refer_to(const LinphoneCall *call){
|
|||
return call->refer_to;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns direction of the call (incoming or outgoing).
|
||||
**/
|
||||
LinphoneCallDir linphone_call_get_dir(const LinphoneCall *call){
|
||||
return call->log->dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the far end's user agent description string, if available.
|
||||
**/
|
||||
const char *linphone_call_get_remote_user_agent(LinphoneCall *call){
|
||||
if (call->op){
|
||||
return sal_op_get_remote_ua (call->op);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this calls has received a transfer that has not been
|
||||
* executed yet.
|
||||
|
|
@ -422,6 +469,74 @@ int linphone_call_get_duration(const LinphoneCall *call){
|
|||
return time(NULL)-call->media_start_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate whether camera input should be sent to remote end.
|
||||
**/
|
||||
void linphone_call_enable_camera (LinphoneCall *call, bool_t enable){
|
||||
#ifdef VIDEO_ENABLED
|
||||
if (call->videostream!=NULL && call->videostream->ticker!=NULL){
|
||||
LinphoneCore *lc=call->core;
|
||||
MSWebCam *nowebcam=get_nowebcam_device();
|
||||
if (call->camera_active!=enable && lc->video_conf.device!=nowebcam){
|
||||
video_stream_change_camera(call->videostream,
|
||||
enable ? lc->video_conf.device : nowebcam);
|
||||
}
|
||||
}
|
||||
call->camera_active=enable;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Take a photo of currently received video and write it into a jpeg file.
|
||||
**/
|
||||
int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file){
|
||||
#ifdef VIDEO_ENABLED
|
||||
if (call->videostream!=NULL && call->videostream->jpegwriter!=NULL){
|
||||
return ms_filter_call_method(call->videostream->jpegwriter,MS_JPEG_WRITER_TAKE_SNAPSHOT,(void*)file);
|
||||
}
|
||||
ms_warning("Cannot take snapshot: no currently running video stream on this call.");
|
||||
return -1;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
bool_t linphone_call_camera_enabled (const LinphoneCall *call){
|
||||
return call->camera_active;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled){
|
||||
cp->has_video=enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp){
|
||||
return cp->has_video;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp){
|
||||
LinphoneCallParams *ncp=ms_new0(LinphoneCallParams,1);
|
||||
memcpy(ncp,cp,sizeof(LinphoneCallParams));
|
||||
return ncp;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
void linphone_call_params_destroy(LinphoneCallParams *p){
|
||||
ms_free(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
**/
|
||||
|
|
@ -466,6 +581,8 @@ void linphone_call_init_media_streams(LinphoneCall *call){
|
|||
#ifdef VIDEO_ENABLED
|
||||
if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].port>0){
|
||||
call->videostream=video_stream_new(md->streams[1].port,linphone_core_ipv6_enabled(lc));
|
||||
if( lc->video_conf.displaytype != NULL)
|
||||
video_stream_set_display_filter_name(call->videostream,lc->video_conf.displaytype);
|
||||
#ifdef TEST_EXT_RENDERER
|
||||
video_stream_set_render_callback(call->videostream,rendercb,NULL);
|
||||
#endif
|
||||
|
|
@ -621,7 +738,13 @@ static RtpProfile *make_profile(LinphoneCore *lc, const SalMediaDescription *md,
|
|||
return prof;
|
||||
}
|
||||
|
||||
void linphone_call_start_media_streams(LinphoneCall *call){
|
||||
static void setup_ring_player(LinphoneCore *lc, LinphoneCall *call){
|
||||
int pause_time=3000;
|
||||
audio_stream_play(call->audiostream,lc->sound_conf.ringback_tone);
|
||||
ms_filter_call_method(call->audiostream->soundread,MS_FILE_PLAYER_LOOP,&pause_time);
|
||||
}
|
||||
|
||||
static void _linphone_call_start_media_streams(LinphoneCall *call, bool_t send_early_media){
|
||||
LinphoneCore *lc=call->core;
|
||||
LinphoneAddress *me=linphone_core_get_primary_contact_parsed(lc);
|
||||
const char *tool="linphone-" LINPHONE_VERSION;
|
||||
|
|
@ -655,16 +778,17 @@ void linphone_call_start_media_streams(LinphoneCall *call){
|
|||
if (captcard==NULL) {
|
||||
ms_warning("No card defined for capture !");
|
||||
}
|
||||
ms_message("streamdir is %i",stream->dir);
|
||||
/*Replace soundcard filters by inactive file players or recorders
|
||||
when placed in recvonly or sendonly mode*/
|
||||
if (stream->port==0 || stream->dir==SalStreamRecvOnly){
|
||||
captcard=NULL;
|
||||
playfile=NULL;
|
||||
}else if (stream->dir==SalStreamSendOnly){
|
||||
}else if (stream->dir==SalStreamSendOnly || send_early_media){
|
||||
playcard=NULL;
|
||||
captcard=NULL;
|
||||
recfile=NULL;
|
||||
if (send_early_media)
|
||||
playfile=NULL;
|
||||
}
|
||||
/*if playfile are supplied don't use soundcards*/
|
||||
if (lc->use_files) {
|
||||
|
|
@ -683,14 +807,15 @@ void linphone_call_start_media_streams(LinphoneCall *call){
|
|||
recfile,
|
||||
playcard,
|
||||
captcard,
|
||||
linphone_core_echo_cancellation_enabled(lc));
|
||||
captcard==NULL ? FALSE : linphone_core_echo_cancellation_enabled(lc));
|
||||
post_configure_audio_streams(call);
|
||||
if (send_early_media) setup_ring_player(lc,call);
|
||||
audio_stream_set_rtcp_information(call->audiostream, cname, tool);
|
||||
}else ms_warning("No audio stream accepted ?");
|
||||
}
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
{
|
||||
if (!send_early_media){
|
||||
const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc,
|
||||
SalProtoRtpAvp,SalVideo);
|
||||
used_pt=-1;
|
||||
|
|
@ -706,12 +831,19 @@ void linphone_call_start_media_streams(LinphoneCall *call){
|
|||
VideoStreamDir dir=VideoStreamSendRecv;
|
||||
MSWebCam *cam=lc->video_conf.device;
|
||||
bool_t is_inactive=FALSE;
|
||||
|
||||
call->params.has_video=TRUE;
|
||||
|
||||
video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc));
|
||||
video_stream_enable_self_view(call->videostream,lc->video_conf.selfview);
|
||||
|
||||
if (lc->video_window_id!=0)
|
||||
video_stream_set_native_window_id(call->videostream,lc->video_window_id);
|
||||
if (lc->preview_window_id!=0)
|
||||
video_stream_set_native_preview_window_id (call->videostream,lc->preview_window_id);
|
||||
video_stream_use_preview_video_window (call->videostream,lc->use_preview_window);
|
||||
|
||||
if (stream->dir==SalStreamSendOnly && lc->video_conf.capture ){
|
||||
cam=ms_web_cam_manager_get_cam(ms_web_cam_manager_get(),"StaticImage: Static picture");
|
||||
cam=get_nowebcam_device();
|
||||
dir=VideoStreamSendOnly;
|
||||
}else if (stream->dir==SalStreamRecvOnly && lc->video_conf.display ){
|
||||
dir=VideoStreamRecvOnly;
|
||||
|
|
@ -727,6 +859,9 @@ void linphone_call_start_media_streams(LinphoneCall *call){
|
|||
/*either inactive or incompatible with local capabilities*/
|
||||
is_inactive=TRUE;
|
||||
}
|
||||
if (call->camera_active==FALSE){
|
||||
cam=get_nowebcam_device();
|
||||
}
|
||||
if (!is_inactive){
|
||||
video_stream_set_direction (call->videostream, dir);
|
||||
video_stream_start(call->videostream,
|
||||
|
|
@ -748,6 +883,13 @@ void linphone_call_start_media_streams(LinphoneCall *call){
|
|||
}
|
||||
|
||||
|
||||
void linphone_call_start_media_streams(LinphoneCall *call){
|
||||
_linphone_call_start_media_streams(call,FALSE);
|
||||
}
|
||||
|
||||
void linphone_call_start_early_media(LinphoneCall *call){
|
||||
_linphone_call_start_media_streams(call,TRUE);
|
||||
}
|
||||
|
||||
static void linphone_call_log_fill_stats(LinphoneCallLog *log, AudioStream *st){
|
||||
audio_stream_get_local_rtp_stats (st,&log->local_stats);
|
||||
|
|
@ -778,4 +920,3 @@ void linphone_call_stop_media_streams(LinphoneCall *call){
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
/*#define UNSTANDART_GSM_11K 1*/
|
||||
|
||||
static const char *liblinphone_version=LIBLINPHONE_VERSION;
|
||||
static void set_network_reachable(LinphoneCore* lc,bool_t isReachable);
|
||||
static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime);
|
||||
|
||||
#include "enum.h"
|
||||
|
||||
|
|
@ -52,6 +52,7 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val);
|
|||
|
||||
extern SalCallbacks linphone_sal_callbacks;
|
||||
|
||||
|
||||
void lc_callback_obj_init(LCCallbackObj *obj,LinphoneCoreCbFunc func,void* ud)
|
||||
{
|
||||
obj->_func=func;
|
||||
|
|
@ -103,7 +104,7 @@ static void call_logs_write_to_config_file(LinphoneCore *lc){
|
|||
char *tmp;
|
||||
LpConfig *cfg=lc->config;
|
||||
|
||||
if (!lc->ready) return;
|
||||
if (linphone_core_get_global_state (lc)==LinphoneGlobalStartup) return;
|
||||
|
||||
for(i=0,elem=lc->call_logs;elem!=NULL;elem=elem->next,++i){
|
||||
LinphoneCallLog *cl=(LinphoneCallLog*)elem->data;
|
||||
|
|
@ -350,8 +351,7 @@ void linphone_core_disable_logs(){
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
net_config_read (LinphoneCore *lc)
|
||||
static void net_config_read (LinphoneCore *lc)
|
||||
{
|
||||
int tmp;
|
||||
const char *tmpstr;
|
||||
|
|
@ -467,6 +467,8 @@ static void sound_config_read(LinphoneCore *lc)
|
|||
|
||||
gain=lp_config_get_float(lc->config,"sound","playback_gain_db",0);
|
||||
linphone_core_set_playback_gain_db (lc,gain);
|
||||
|
||||
linphone_core_set_remote_ringback_tone (lc,lp_config_get_string(lc->config,"sound","ringback_tone",NULL));
|
||||
}
|
||||
|
||||
static void sip_config_read(LinphoneCore *lc)
|
||||
|
|
@ -626,7 +628,7 @@ static PayloadType * find_payload(RtpProfile *prof, const char *mime_type, int c
|
|||
return candidate;
|
||||
}
|
||||
|
||||
static bool_t get_codec(LpConfig *config, char* type, int index, PayloadType **ret){
|
||||
static bool_t get_codec(LpConfig *config, const char* type, int index, PayloadType **ret){
|
||||
char codeckey[50];
|
||||
const char *mime,*fmtp;
|
||||
int rate,enabled;
|
||||
|
|
@ -704,6 +706,17 @@ static MSList *add_missing_codecs(SalStreamType mtype, MSList *l){
|
|||
return l;
|
||||
}
|
||||
|
||||
static MSList *codec_append_if_new(MSList *l, PayloadType *pt){
|
||||
MSList *elem;
|
||||
for (elem=l;elem!=NULL;elem=elem->next){
|
||||
PayloadType *ept=(PayloadType*)elem->data;
|
||||
if (pt==ept)
|
||||
return l;
|
||||
}
|
||||
l=ms_list_append(l,pt);
|
||||
return l;
|
||||
}
|
||||
|
||||
static void codecs_config_read(LinphoneCore *lc)
|
||||
{
|
||||
int i;
|
||||
|
|
@ -714,7 +727,7 @@ static void codecs_config_read(LinphoneCore *lc)
|
|||
if (pt){
|
||||
if (!ms_filter_codec_supported(pt->mime_type)){
|
||||
ms_warning("Codec %s is not supported by mediastreamer2, removed.",pt->mime_type);
|
||||
}else audio_codecs=ms_list_append(audio_codecs,pt);
|
||||
}else audio_codecs=codec_append_if_new(audio_codecs,pt);
|
||||
}
|
||||
}
|
||||
audio_codecs=add_missing_codecs(SalAudio,audio_codecs);
|
||||
|
|
@ -722,7 +735,7 @@ static void codecs_config_read(LinphoneCore *lc)
|
|||
if (pt){
|
||||
if (!ms_filter_codec_supported(pt->mime_type)){
|
||||
ms_warning("Codec %s is not supported by mediastreamer2, removed.",pt->mime_type);
|
||||
}else video_codecs=ms_list_append(video_codecs,(void *)pt);
|
||||
}else video_codecs=codec_append_if_new(video_codecs,(void *)pt);
|
||||
}
|
||||
}
|
||||
video_codecs=add_missing_codecs(SalVideo,video_codecs);
|
||||
|
|
@ -761,6 +774,9 @@ static void video_config_read(LinphoneCore *lc){
|
|||
capture=lp_config_get_int(lc->config,"video","capture",enabled);
|
||||
display=lp_config_get_int(lc->config,"video","display",enabled);
|
||||
self_view=lp_config_get_int(lc->config,"video","self_view",enabled);
|
||||
lc->video_conf.displaytype=lp_config_get_string(lc->config,"video","displaytype",NULL);
|
||||
if(lc->video_conf.displaytype)
|
||||
ms_message("we are using a specific display:%s\n",lc->video_conf.displaytype);
|
||||
#ifdef VIDEO_ENABLED
|
||||
linphone_core_enable_video(lc,capture,display);
|
||||
linphone_core_enable_self_view(lc,self_view);
|
||||
|
|
@ -903,6 +919,7 @@ static void linphone_core_free_payload_types(void){
|
|||
}
|
||||
|
||||
void linphone_core_set_state(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message){
|
||||
lc->state=gstate;
|
||||
if (lc->vtable.global_state_changed){
|
||||
lc->vtable.global_state_changed(lc,gstate,message);
|
||||
}
|
||||
|
|
@ -922,13 +939,21 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
|
|||
linphone_core_assign_payload_type(&payload_type_gsm,3,NULL);
|
||||
linphone_core_assign_payload_type(&payload_type_pcma8000,8,NULL);
|
||||
linphone_core_assign_payload_type(&payload_type_lpc1015,115,NULL);
|
||||
linphone_core_assign_payload_type(&payload_type_speex_nb,110,"vbr=on");
|
||||
linphone_core_assign_payload_type(&payload_type_speex_wb,111,"vbr=on");
|
||||
linphone_core_assign_payload_type(&payload_type_speex_nb,110,"vbr=vad");
|
||||
linphone_core_assign_payload_type(&payload_type_speex_wb,111,"vbr=vad");
|
||||
linphone_core_assign_payload_type(&payload_type_speex_uwb,112,"vbr=on");
|
||||
linphone_core_assign_payload_type(&payload_type_telephone_event,101,"0-11");
|
||||
linphone_core_assign_payload_type(&payload_type_ilbc,113,"mode=30");
|
||||
linphone_core_assign_payload_type(&payload_type_amr,114,"octet-align=1");
|
||||
|
||||
#if defined(ANDROID) || defined (__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||
/*shorten the DNS lookup time and send more retransmissions on mobiles:
|
||||
- to workaround potential packet losses
|
||||
- to avoid hanging for 30 seconds when the network doesn't work despite the phone thinks it does.
|
||||
*/
|
||||
_linphone_core_configure_resolver();
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NONSTANDARD_GSM
|
||||
{
|
||||
PayloadType *pt;
|
||||
|
|
@ -980,10 +1005,8 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
|
|||
ui_config_read(lc);
|
||||
if (lc->vtable.display_status)
|
||||
lc->vtable.display_status(lc,_("Ready"));
|
||||
linphone_core_set_state(lc,LinphoneGlobalOn,"Ready");
|
||||
lc->auto_net_state_mon=lc->sip_conf.auto_net_state_mon;
|
||||
|
||||
lc->ready=TRUE;
|
||||
linphone_core_set_state(lc,LinphoneGlobalOn,"Ready");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1513,7 +1536,7 @@ static void monitor_network_state(LinphoneCore *lc, time_t curtime){
|
|||
if (new_status){
|
||||
ms_message("New local ip address is %s",result);
|
||||
}
|
||||
set_network_reachable(lc,new_status);
|
||||
set_network_reachable(lc,new_status, curtime);
|
||||
last_status=new_status;
|
||||
}
|
||||
}
|
||||
|
|
@ -1708,6 +1731,12 @@ void linphone_core_iterate(LinphoneCore *lc){
|
|||
|
||||
linphone_core_do_plugin_tasks(lc);
|
||||
|
||||
if (lc->initial_subscribes_sent==FALSE && lc->netup_time!=0 &&
|
||||
(curtime-lc->netup_time)>3){
|
||||
linphone_core_send_initial_subscribes(lc);
|
||||
lc->initial_subscribes_sent=TRUE;
|
||||
}
|
||||
|
||||
if (one_second_elapsed && lp_config_needs_commit(lc->config)){
|
||||
lp_config_sync(lc->config);
|
||||
}
|
||||
|
|
@ -1791,7 +1820,7 @@ LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url)
|
|||
/**
|
||||
* Returns the default identity SIP address.
|
||||
*
|
||||
* @ingroup proxiesb
|
||||
* @ingroup proxies
|
||||
* This is an helper function:
|
||||
*
|
||||
* If no default proxy is set, this will return the primary contact (
|
||||
|
|
@ -1818,35 +1847,14 @@ const char * linphone_core_get_route(LinphoneCore *lc){
|
|||
return route;
|
||||
}
|
||||
|
||||
bool_t linphone_core_is_in_communication_with(LinphoneCore *lc, const char *to)
|
||||
{
|
||||
char *tmp;
|
||||
bool_t returned;
|
||||
const LinphoneAddress *la=linphone_core_get_current_call_remote_address(lc);
|
||||
if(la == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
tmp = linphone_address_as_string(la);
|
||||
if(!strcmp(tmp,to))
|
||||
returned = TRUE;
|
||||
else
|
||||
returned = FALSE;
|
||||
if(tmp)
|
||||
ms_free(tmp);
|
||||
return returned;
|
||||
}
|
||||
|
||||
void linphone_core_start_pending_refered_calls(LinphoneCore *lc){
|
||||
MSList *elem;
|
||||
for(elem=lc->calls;elem!=NULL;elem=elem->next){
|
||||
LinphoneCall *call=(LinphoneCall*)elem->data;
|
||||
if (call->refer_pending){
|
||||
ms_message("Starting new call to refered address %s",call->refer_to);
|
||||
call->refer_pending=FALSE;
|
||||
linphone_core_invite(lc,call->refer_to);
|
||||
break;
|
||||
}
|
||||
void linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *call){
|
||||
if (call->refer_pending){
|
||||
LinphoneCallParams *cp=linphone_core_create_default_call_parameters(lc);
|
||||
cp->referer=call;
|
||||
ms_message("Starting new call to refered address %s",call->refer_to);
|
||||
call->refer_pending=FALSE;
|
||||
linphone_core_invite_with_params(lc,call->refer_to,cp);
|
||||
linphone_call_params_destroy(cp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1864,6 +1872,17 @@ LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const L
|
|||
return found_cfg;
|
||||
}
|
||||
|
||||
const char *linphone_core_find_best_identity(LinphoneCore *lc, const LinphoneAddress *to, const char **route){
|
||||
LinphoneProxyConfig *cfg=linphone_core_lookup_known_proxy(lc,to);
|
||||
if (cfg==NULL)
|
||||
linphone_core_get_default_proxy (lc,&cfg);
|
||||
if (cfg!=NULL){
|
||||
*route=linphone_proxy_config_get_route(cfg);
|
||||
return linphone_proxy_config_get_identity (cfg);
|
||||
}
|
||||
return linphone_core_get_primary_contact (lc);
|
||||
}
|
||||
|
||||
static char *get_fixed_contact(LinphoneCore *lc, LinphoneCall *call , LinphoneProxyConfig *dest_proxy){
|
||||
LinphoneAddress *ctt;
|
||||
const char *localip=call->localip;
|
||||
|
|
@ -1964,12 +1983,39 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphonePro
|
|||
* @ingroup call_control
|
||||
* @param lc the LinphoneCore object
|
||||
* @param url the destination of the call (sip address, or phone number).
|
||||
*
|
||||
* The application doesn't own a reference to the returned LinphoneCall object.
|
||||
* Use linphone_call_ref() to safely keep the LinphoneCall pointer valid within your application.
|
||||
*
|
||||
* @return a LinphoneCall object or NULL in case of failure
|
||||
**/
|
||||
LinphoneCall * linphone_core_invite(LinphoneCore *lc, const char *url){
|
||||
LinphoneCall *call;
|
||||
LinphoneCallParams *p=linphone_core_create_default_call_parameters (lc);
|
||||
call=linphone_core_invite_with_params(lc,url,p);
|
||||
linphone_call_params_destroy(p);
|
||||
return call;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initiates an outgoing call according to supplied call parameters
|
||||
*
|
||||
* @ingroup call_control
|
||||
* @param lc the LinphoneCore object
|
||||
* @param url the destination of the call (sip address, or phone number).
|
||||
* @param p call parameters
|
||||
*
|
||||
* The application doesn't own a reference to the returned LinphoneCall object.
|
||||
* Use linphone_call_ref() to safely keep the LinphoneCall pointer valid within your application.
|
||||
*
|
||||
* @return a LinphoneCall object or NULL in case of failure
|
||||
**/
|
||||
LinphoneCall * linphone_core_invite_with_params(LinphoneCore *lc, const char *url, const LinphoneCallParams *p){
|
||||
LinphoneAddress *addr=linphone_core_interpret_url(lc,url);
|
||||
if (addr){
|
||||
LinphoneCall *call;
|
||||
call=linphone_core_invite_address(lc,addr);
|
||||
call=linphone_core_invite_address_with_params(lc,addr,p);
|
||||
linphone_address_destroy(addr);
|
||||
return call;
|
||||
}
|
||||
|
|
@ -1981,12 +2027,40 @@ LinphoneCall * linphone_core_invite(LinphoneCore *lc, const char *url){
|
|||
*
|
||||
* @ingroup call_control
|
||||
* @param lc the LinphoneCore object
|
||||
* @param real_parsed_url the destination of the call (sip address).
|
||||
* @param addr the destination of the call (sip address).
|
||||
*
|
||||
* The LinphoneAddress can be constructed directly using linphone_address_new(), or
|
||||
* created by linphone_core_interpret_url().
|
||||
* The application doesn't own a reference to the returned LinphoneCall object.
|
||||
* Use linphone_call_ref() to safely keep the LinphoneCall pointer valid within your application.
|
||||
*
|
||||
* @return a LinphoneCall object or NULL in case of failure
|
||||
**/
|
||||
LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddress *real_parsed_url)
|
||||
LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddress *addr){
|
||||
LinphoneCall *call;
|
||||
LinphoneCallParams *p=linphone_core_create_default_call_parameters (lc);
|
||||
call=linphone_core_invite_address_with_params (lc,addr,p);
|
||||
linphone_call_params_destroy(p);
|
||||
return call;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initiates an outgoing call given a destination LinphoneAddress
|
||||
*
|
||||
* @ingroup call_control
|
||||
* @param lc the LinphoneCore object
|
||||
* @param addr the destination of the call (sip address).
|
||||
@param params call parameters
|
||||
*
|
||||
* The LinphoneAddress can be constructed directly using linphone_address_new(), or
|
||||
* created by linphone_core_interpret_url().
|
||||
* The application doesn't own a reference to the returned LinphoneCall object.
|
||||
* Use linphone_call_ref() to safely keep the LinphoneCall pointer valid within your application.
|
||||
*
|
||||
* @return a LinphoneCall object or NULL in case of failure
|
||||
**/
|
||||
LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const LinphoneAddress *addr, const LinphoneCallParams *params)
|
||||
{
|
||||
int err=0;
|
||||
const char *route=NULL;
|
||||
|
|
@ -2010,8 +2084,8 @@ LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddr
|
|||
linphone_core_get_default_proxy(lc,&proxy);
|
||||
route=linphone_core_get_route(lc);
|
||||
|
||||
real_url=linphone_address_as_string(real_parsed_url);
|
||||
dest_proxy=linphone_core_lookup_known_proxy(lc,real_parsed_url);
|
||||
real_url=linphone_address_as_string(addr);
|
||||
dest_proxy=linphone_core_lookup_known_proxy(lc,addr);
|
||||
|
||||
if (proxy!=dest_proxy && dest_proxy!=NULL) {
|
||||
ms_message("Overriding default proxy setting for this call:");
|
||||
|
|
@ -2028,7 +2102,7 @@ LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddr
|
|||
|
||||
parsed_url2=linphone_address_new(from);
|
||||
|
||||
call=linphone_call_new_outgoing(lc,parsed_url2,linphone_address_clone(real_parsed_url));
|
||||
call=linphone_call_new_outgoing(lc,parsed_url2,linphone_address_clone(addr),params);
|
||||
sal_op_set_route(call->op,route);
|
||||
|
||||
if(linphone_core_add_call(lc,call)!= 0)
|
||||
|
|
@ -2075,12 +2149,28 @@ int linphone_core_transfer_call(LinphoneCore *lc, LinphoneCall *call, const char
|
|||
}
|
||||
//lc->call=NULL; //Do not do that you will lose the call afterward . . .
|
||||
real_url=linphone_address_as_string (real_parsed_url);
|
||||
sal_refer(call->op,real_url);
|
||||
sal_call_refer(call->op,real_url);
|
||||
ms_free(real_url);
|
||||
linphone_address_destroy(real_parsed_url);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfer a call to destination of another running call. This is used for "attended transfer" scenarios.
|
||||
* @param lc linphone core object
|
||||
* @param call a running call you want to transfer
|
||||
* @param dest a running call whose remote person will receive the transfer
|
||||
*
|
||||
* The transfered call is supposed to be in paused state, so that it is able to accept the transfer immediately.
|
||||
* The destination call is a call previously established to introduce the transfered person.
|
||||
* This method will send a transfer request to the transfered person. The phone of the transfered is then
|
||||
* expected to automatically call to the destination of the transfer. The receiver of the transfer will then automatically
|
||||
* close the call with us (the 'dest' call).
|
||||
**/
|
||||
int linphone_core_transfer_call_to_another(LinphoneCore *lc, LinphoneCall *call, LinphoneCall *dest){
|
||||
return sal_call_refer_with_replaces (call->op,dest->op);
|
||||
}
|
||||
|
||||
bool_t linphone_core_inc_invite_pending(LinphoneCore*lc){
|
||||
LinphoneCall *call = linphone_core_get_current_call(lc);
|
||||
if(call != NULL)
|
||||
|
|
@ -2091,6 +2181,27 @@ bool_t linphone_core_inc_invite_pending(LinphoneCore*lc){
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a running call according to supplied call parameters.
|
||||
*
|
||||
* For the moment, this is limited to enabling or disabling the video stream.
|
||||
*
|
||||
* @return 0 if successful, -1 otherwise.
|
||||
**/
|
||||
int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, LinphoneCallParams *params){
|
||||
int err;
|
||||
|
||||
if (call->localdesc)
|
||||
sal_media_description_unref(call->localdesc);
|
||||
call->localdesc=create_local_media_description (lc,call,
|
||||
params->has_video,FALSE);
|
||||
if (lc->vtable.display_status)
|
||||
lc->vtable.display_status(lc,_("Modifying call parameters..."));
|
||||
sal_call_set_local_media_description (call->op,call->localdesc);
|
||||
err=sal_call_update(call->op);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Accept an incoming call.
|
||||
|
|
@ -2109,6 +2220,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
|
|||
{
|
||||
LinphoneProxyConfig *cfg=NULL;
|
||||
const char *contact=NULL;
|
||||
SalOp *replaced;
|
||||
|
||||
if (call==NULL){
|
||||
//if just one call is present answer the only one ...
|
||||
|
|
@ -2118,16 +2230,27 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
|
|||
call = (LinphoneCall*)linphone_core_get_calls(lc)->data;
|
||||
}
|
||||
|
||||
if (call->state==LinphoneCallConnected){
|
||||
/*call already accepted*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* check if this call is supposed to replace an already running one*/
|
||||
replaced=sal_call_get_replaces(call->op);
|
||||
if (replaced){
|
||||
LinphoneCall *rc=(LinphoneCall*)sal_op_get_user_pointer (replaced);
|
||||
if (rc){
|
||||
ms_message("Call %p replaces call %p. This last one is going to be terminated automatically.",
|
||||
call,rc);
|
||||
linphone_core_terminate_call (lc,rc);
|
||||
}
|
||||
}
|
||||
|
||||
if (lc->current_call!=NULL && lc->current_call!=call){
|
||||
ms_warning("Cannot accept this call, there is already one running.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (call->state==LinphoneCallConnected){
|
||||
/*call already accepted*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*can accept a new call only if others are on hold */
|
||||
{
|
||||
MSList *elem;
|
||||
|
|
@ -2155,6 +2278,12 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
|
|||
sal_op_set_contact(call->op,contact);
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 40000
|
||||
linphone_call_init_media_streams(call);
|
||||
#else
|
||||
if (call->audiostream!=NULL && call->audiostream->ticker!=NULL){
|
||||
/*case where we sent early media*/
|
||||
linphone_call_stop_media_streams (call);
|
||||
linphone_call_init_media_streams (call);
|
||||
}
|
||||
#endif
|
||||
sal_call_accept(call->op);
|
||||
if (lc->vtable.display_status!=NULL)
|
||||
|
|
@ -2211,7 +2340,9 @@ int linphone_core_terminate_call(LinphoneCore *lc, LinphoneCall *the_call)
|
|||
call = the_call;
|
||||
}
|
||||
sal_call_terminate(call->op);
|
||||
|
||||
if (call->state==LinphoneCallIncomingReceived){
|
||||
call->reason=LinphoneReasonDeclined;
|
||||
}
|
||||
/*stop ringing*/
|
||||
if (lc->ringstream!=NULL) {
|
||||
ring_stop(lc->ringstream);
|
||||
|
|
@ -2299,7 +2430,6 @@ int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *the_call)
|
|||
lc->current_call=NULL;
|
||||
if (call->audiostream || call->videostream)
|
||||
linphone_call_stop_media_streams (call);
|
||||
linphone_core_start_pending_refered_calls(lc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2350,28 +2480,9 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the remote address with the one in call
|
||||
*
|
||||
* @param a the call
|
||||
* @param b the remote address to compare with
|
||||
* @return 0 if it's the good call else 1
|
||||
*/
|
||||
static int linphone_call_remote_address_compare(const void * a, const void * b)
|
||||
{
|
||||
if(b == NULL || a ==NULL)
|
||||
return 1;
|
||||
char *the_remote_address = ((char *)b);
|
||||
LinphoneCall *call = ((LinphoneCall *)a);
|
||||
#ifdef DEBUG
|
||||
ms_message("the remote address:%s\n",the_remote_address);
|
||||
ms_message("the call:%p => %s\n",call,linphone_call_get_remote_address_as_string(call));
|
||||
#endif
|
||||
if(!strcmp(linphone_call_get_remote_address_as_string(call),the_remote_address))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
static int remote_address_compare(LinphoneCall *call, const LinphoneAddress *raddr){
|
||||
const LinphoneAddress *addr=linphone_call_get_remote_address (call);
|
||||
return !linphone_address_weak_equal (addr,raddr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2381,12 +2492,9 @@ static int linphone_call_remote_address_compare(const void * a, const void * b)
|
|||
* @return the LinphoneCall of the call if found
|
||||
*/
|
||||
LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const char *remote_address){
|
||||
|
||||
MSList *the_call = ms_list_find_custom(lc->calls,linphone_call_remote_address_compare,(void *)remote_address);
|
||||
if(the_call != NULL)
|
||||
{
|
||||
return ((LinphoneCall *)the_call->data);
|
||||
}
|
||||
LinphoneAddress *raddr=linphone_address_new(remote_address);
|
||||
MSList *elem=ms_list_find_custom(lc->calls,(int (*)(const void*,const void *))remote_address_compare,raddr);
|
||||
if (elem) return (LinphoneCall*) elem->data;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -2612,7 +2720,7 @@ bool_t linphone_core_sound_device_can_playback(LinphoneCore *lc, const char *dev
|
|||
int linphone_core_set_ringer_device(LinphoneCore *lc, const char * devid){
|
||||
MSSndCard *card=get_card_from_string_id(devid,MS_SND_CARD_CAP_PLAYBACK);
|
||||
lc->sound_conf.ring_sndcard=card;
|
||||
if (card && lc->ready)
|
||||
if (card && linphone_core_ready(lc))
|
||||
lp_config_set_string(lc->config,"sound","ringer_dev_id",ms_snd_card_get_string_id(card));
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2626,7 +2734,7 @@ int linphone_core_set_ringer_device(LinphoneCore *lc, const char * devid){
|
|||
int linphone_core_set_playback_device(LinphoneCore *lc, const char * devid){
|
||||
MSSndCard *card=get_card_from_string_id(devid,MS_SND_CARD_CAP_PLAYBACK);
|
||||
lc->sound_conf.play_sndcard=card;
|
||||
if (card && lc->ready)
|
||||
if (card && linphone_core_ready(lc))
|
||||
lp_config_set_string(lc->config,"sound","playback_dev_id",ms_snd_card_get_string_id(card));
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2640,7 +2748,7 @@ int linphone_core_set_playback_device(LinphoneCore *lc, const char * devid){
|
|||
int linphone_core_set_capture_device(LinphoneCore *lc, const char * devid){
|
||||
MSSndCard *card=get_card_from_string_id(devid,MS_SND_CARD_CAP_CAPTURE);
|
||||
lc->sound_conf.capt_sndcard=card;
|
||||
if (card && lc->ready)
|
||||
if (card && linphone_core_ready(lc))
|
||||
lp_config_set_string(lc->config,"sound","capture_dev_id",ms_snd_card_get_string_id(card));
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2731,7 +2839,7 @@ void linphone_core_set_ring(LinphoneCore *lc,const char *path){
|
|||
ms_free(lc->sound_conf.local_ring);
|
||||
}
|
||||
lc->sound_conf.local_ring=ms_strdup(path);
|
||||
if (lc->ready && lc->sound_conf.local_ring)
|
||||
if ( linphone_core_ready(lc) && lc->sound_conf.local_ring)
|
||||
lp_config_set_string(lc->config,"sound","local_ring",lc->sound_conf.local_ring);
|
||||
}
|
||||
|
||||
|
|
@ -2795,7 +2903,7 @@ const char * linphone_core_get_ringback(const LinphoneCore *lc){
|
|||
**/
|
||||
void linphone_core_enable_echo_cancellation(LinphoneCore *lc, bool_t val){
|
||||
lc->sound_conf.ec=val;
|
||||
if (lc->ready)
|
||||
if ( linphone_core_ready(lc))
|
||||
lp_config_set_int(lc->config,"sound","echocancellation",val);
|
||||
}
|
||||
|
||||
|
|
@ -2985,8 +3093,13 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val){
|
|||
#ifdef VIDEO_ENABLED
|
||||
if (val){
|
||||
if (lc->previewstream==NULL){
|
||||
lc->previewstream=video_preview_start(lc->video_conf.device,
|
||||
lc->video_conf.vsize);
|
||||
lc->previewstream=video_preview_new();
|
||||
video_preview_set_size(lc->previewstream,lc->video_conf.vsize);
|
||||
if (lc->video_conf.displaytype)
|
||||
video_preview_set_display_filter_name(lc->previewstream,lc->video_conf.displaytype);
|
||||
if (lc->preview_window_id!=0)
|
||||
video_preview_set_native_window_id(lc->previewstream,lc->preview_window_id);
|
||||
video_preview_start(lc->previewstream,lc->video_conf.device);
|
||||
}
|
||||
}else{
|
||||
if (lc->previewstream!=NULL){
|
||||
|
|
@ -3100,7 +3213,7 @@ int linphone_core_set_video_device(LinphoneCore *lc, const char *id){
|
|||
if (olddev!=NULL && olddev!=lc->video_conf.device){
|
||||
toggle_video_preview(lc,FALSE);/*restart the video local preview*/
|
||||
}
|
||||
if (lc->ready && lc->video_conf.device){
|
||||
if ( linphone_core_ready(lc) && lc->video_conf.device){
|
||||
vd=ms_web_cam_get_string_id(lc->video_conf.device);
|
||||
if (vd && strstr(vd,"Static picture")!=NULL){
|
||||
vd=NULL;
|
||||
|
|
@ -3144,7 +3257,7 @@ int linphone_core_set_static_picture(LinphoneCore *lc, const char *path) {
|
|||
force the filter to use that picture. */
|
||||
if (vs && vs->source) {
|
||||
if (ms_filter_get_id(vs->source) == MS_STATIC_IMAGE_ID) {
|
||||
ms_filter_call_method(vs->source, MS_FILTER_SET_IMAGE,
|
||||
ms_filter_call_method(vs->source, MS_STATIC_IMAGE_SET_IMAGE,
|
||||
(void *)path);
|
||||
}
|
||||
}
|
||||
|
|
@ -3212,7 +3325,55 @@ unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc){
|
|||
if (lc->previewstream)
|
||||
return video_stream_get_native_window_id(lc->previewstream);
|
||||
#endif
|
||||
return 0;
|
||||
return lc->video_window_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the native video window id where the video is to be displayed.
|
||||
* If not set the core will create its own window.
|
||||
**/
|
||||
void linphone_core_set_native_video_window_id(LinphoneCore *lc, unsigned long id){
|
||||
#ifdef VIDEO_ENABLED
|
||||
LinphoneCall *call=linphone_core_get_current_call(lc);
|
||||
lc->video_window_id=id;
|
||||
if (call!=NULL && call->videostream){
|
||||
video_stream_set_native_window_id(call->videostream,id);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the native window handle of the video preview window, casted as an unsigned long.
|
||||
*
|
||||
* @ingroup media_parameters
|
||||
**/
|
||||
unsigned long linphone_core_get_native_preview_window_id(const LinphoneCore *lc){
|
||||
#ifdef VIDEO_ENABLED
|
||||
LinphoneCall *call=linphone_core_get_current_call (lc);
|
||||
if (call && call->videostream)
|
||||
return video_stream_get_native_preview_window_id(call->videostream);
|
||||
if (lc->previewstream)
|
||||
return video_preview_get_native_window_id(lc->previewstream);
|
||||
#endif
|
||||
return lc->preview_window_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the native window id where the preview video (local camera) is to be displayed.
|
||||
* This has to be used in conjonction with linphone_core_use_preview_window().
|
||||
* If not set the core will create its own window.
|
||||
**/
|
||||
void linphone_core_set_native_preview_window_id(LinphoneCore *lc, unsigned long id){
|
||||
lc->preview_window_id=id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells the core to use a separate window for local camera preview video, instead of
|
||||
* inserting local view within the remote video window.
|
||||
*
|
||||
**/
|
||||
void linphone_core_use_preview_window(LinphoneCore *lc, bool_t yesno){
|
||||
lc->use_preview_window=yesno;
|
||||
}
|
||||
|
||||
static MSVideoSizeDef supported_resolutions[]={
|
||||
|
|
@ -3277,7 +3438,7 @@ void linphone_core_set_preferred_video_size(LinphoneCore *lc, MSVideoSize vsize)
|
|||
toggle_video_preview(lc,FALSE);
|
||||
toggle_video_preview(lc,TRUE);
|
||||
}
|
||||
if (lc->ready)
|
||||
if ( linphone_core_ready(lc))
|
||||
lp_config_set_string(lc->config,"video","size",video_size_get_name(vsize));
|
||||
}
|
||||
}
|
||||
|
|
@ -3391,10 +3552,12 @@ void linphone_core_play_dtmf(LinphoneCore *lc, char dtmf, int duration_ms){
|
|||
**/
|
||||
void linphone_core_stop_dtmf(LinphoneCore *lc){
|
||||
MSFilter *f=get_dtmf_gen(lc);
|
||||
ms_filter_call_method_noarg (f, MS_DTMF_GEN_STOP);
|
||||
if (f!=NULL)
|
||||
ms_filter_call_method_noarg (f, MS_DTMF_GEN_STOP);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the user pointer that was given to linphone_core_new()
|
||||
*
|
||||
|
|
@ -3501,6 +3664,7 @@ void sip_config_uninit(LinphoneCore *lc)
|
|||
int i;
|
||||
sip_config_t *config=&lc->sip_conf;
|
||||
lp_config_set_int(lc->config,"sip","sip_port",config->transports.udp_port);
|
||||
lp_config_set_int(lc->config,"sip","sip_tcp_port",config->transports.tcp_port);
|
||||
lp_config_set_int(lc->config,"sip","guess_hostname",config->guess_hostname);
|
||||
lp_config_set_string(lc->config,"sip","contact",config->contact);
|
||||
lp_config_set_int(lc->config,"sip","inc_timeout",config->inc_timeout);
|
||||
|
|
@ -3692,7 +3856,7 @@ static void linphone_core_uninit(LinphoneCore *lc)
|
|||
linphone_core_set_state(lc,LinphoneGlobalOff,"Off");
|
||||
}
|
||||
|
||||
static void set_network_reachable(LinphoneCore* lc,bool_t isReachable){
|
||||
static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime){
|
||||
ms_message("Network state is now [%s]",isReachable?"UP":"DOWN");
|
||||
// second get the list of available proxies
|
||||
const MSList *elem=linphone_core_get_proxy_config_list(lc);
|
||||
|
|
@ -3706,6 +3870,7 @@ static void set_network_reachable(LinphoneCore* lc,bool_t isReachable){
|
|||
}
|
||||
}
|
||||
}
|
||||
lc->netup_time=curtime;
|
||||
lc->network_reachable=isReachable;
|
||||
}
|
||||
|
||||
|
|
@ -3715,7 +3880,7 @@ void linphone_core_set_network_reachable(LinphoneCore* lc,bool_t isReachable) {
|
|||
ms_message("Disabling automatic network state monitoring");
|
||||
lc->auto_net_state_mon=FALSE;
|
||||
}
|
||||
set_network_reachable(lc,isReachable);
|
||||
set_network_reachable(lc,isReachable, ms_time(NULL));
|
||||
}
|
||||
|
||||
bool_t linphone_core_is_network_reachabled(LinphoneCore* lc) {
|
||||
|
|
@ -3785,6 +3950,25 @@ int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifiies a ring back tone to be played to far end during incoming calls.
|
||||
**/
|
||||
void linphone_core_set_remote_ringback_tone(LinphoneCore *lc, const char *file){
|
||||
if (lc->sound_conf.ringback_tone){
|
||||
ms_free(lc->sound_conf.ringback_tone);
|
||||
lc->sound_conf.ringback_tone=NULL;
|
||||
}
|
||||
if (file)
|
||||
lc->sound_conf.ringback_tone=ms_strdup(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ring back tone played to far end during incoming calls.
|
||||
**/
|
||||
const char *linphone_core_get_remote_ringback_tone(const LinphoneCore *lc){
|
||||
return lc->sound_conf.ringback_tone;
|
||||
}
|
||||
|
||||
static PayloadType* find_payload_type_from_list(const char* type, int rate,const MSList* from) {
|
||||
const MSList *elem;
|
||||
for(elem=from;elem!=NULL;elem=elem->next){
|
||||
|
|
@ -3815,3 +3999,46 @@ PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type,
|
|||
/*not found*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *linphone_global_state_to_string(LinphoneGlobalState gs){
|
||||
switch(gs){
|
||||
case LinphoneGlobalOff:
|
||||
return "LinphoneGlobalOff";
|
||||
break;
|
||||
case LinphoneGlobalOn:
|
||||
return "LinphoneGlobalOn";
|
||||
break;
|
||||
case LinphoneGlobalStartup:
|
||||
return "LinphoneGlobalStartup";
|
||||
break;
|
||||
case LinphoneGlobalShutdown:
|
||||
return "LinphoneGlobalShutdown";
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc){
|
||||
return lc->state;
|
||||
}
|
||||
|
||||
LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *lc){
|
||||
LinphoneCallParams *p=ms_new0(LinphoneCallParams,1);
|
||||
p->has_video=linphone_core_video_enabled(lc);
|
||||
return p;
|
||||
}
|
||||
|
||||
const char *linphone_error_to_string(LinphoneReason err){
|
||||
switch(err){
|
||||
case LinphoneReasonNone:
|
||||
return "No error";
|
||||
case LinphoneReasonNoResponse:
|
||||
return "No response";
|
||||
case LinphoneReasonBadCredentials:
|
||||
return "Bad credentials";
|
||||
case LinphoneReasonDeclined:
|
||||
return "Call declined";
|
||||
}
|
||||
return "unknown error";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,11 @@ extern "C" {
|
|||
|
||||
struct _MSSndCard;
|
||||
struct _LinphoneCore;
|
||||
/**
|
||||
* Linphone core main object created by function linphone_core_new() .
|
||||
* @ingroup initializing
|
||||
*/
|
||||
typedef struct _LinphoneCore LinphoneCore;
|
||||
struct SalOp;
|
||||
|
||||
struct _LpConfig;
|
||||
|
|
@ -68,6 +73,11 @@ typedef struct _LCSipTransports LCSipTransports;
|
|||
* @var LinphoneAddress
|
||||
*/
|
||||
typedef struct SalAddress LinphoneAddress;
|
||||
#ifdef IN_LINPHONE
|
||||
#include "linphonefriend.h"
|
||||
#else
|
||||
#include "linphone/linphonefriend.h"
|
||||
#endif
|
||||
|
||||
LinphoneAddress * linphone_address_new(const char *uri);
|
||||
LinphoneAddress * linphone_address_clone(const LinphoneAddress *uri);
|
||||
|
|
@ -93,6 +103,7 @@ void linphone_address_set_port_int(LinphoneAddress *uri, int port);
|
|||
void linphone_address_clean(LinphoneAddress *uri);
|
||||
char *linphone_address_as_string(const LinphoneAddress *u);
|
||||
char *linphone_address_as_string_uri_only(const LinphoneAddress *u);
|
||||
bool_t linphone_address_weak_equal(const LinphoneAddress *a1, const LinphoneAddress *a2);
|
||||
void linphone_address_destroy(LinphoneAddress *u);
|
||||
|
||||
struct _SipSetupContext;
|
||||
|
|
@ -120,7 +131,8 @@ typedef enum _LinphoneCallDir LinphoneCallDir;
|
|||
typedef enum _LinphoneCallStatus {
|
||||
LinphoneCallSuccess, /**< The call was sucessful*/
|
||||
LinphoneCallAborted, /**< The call was aborted */
|
||||
LinphoneCallMissed /**< The call was missed (unanswered)*/
|
||||
LinphoneCallMissed, /**< The call was missed (unanswered)*/
|
||||
LinphoneCallDeclined /**< The call was declined, either locally or by remote end*/
|
||||
} LinphoneCallStatus;
|
||||
|
||||
/**
|
||||
|
|
@ -155,6 +167,33 @@ const rtp_stats_t *linphone_call_log_get_remote_stats(const LinphoneCallLog *cl)
|
|||
char * linphone_call_log_to_str(LinphoneCallLog *cl);
|
||||
|
||||
|
||||
/**
|
||||
* The LinphoneCallParams is an object contaning various call related parameters.
|
||||
* It can be used to retrieve parameters from a currently running call or modify the call's characterisitcs
|
||||
* dynamically.
|
||||
**/
|
||||
struct _LinphoneCallParams;
|
||||
typedef struct _LinphoneCallParams LinphoneCallParams;
|
||||
|
||||
LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp);
|
||||
void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled);
|
||||
bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp);
|
||||
void linphone_call_params_destroy(LinphoneCallParams *cp);
|
||||
|
||||
/**
|
||||
* Enum describing failure reasons.
|
||||
**/
|
||||
enum _LinphoneReason{
|
||||
LinphoneReasonNone,
|
||||
LinphoneReasonNoResponse, /**<No response received from remote*/
|
||||
LinphoneReasonBadCredentials, /**<Authentication failed due to bad or missing credentials*/
|
||||
LinphoneReasonDeclined, /**<The call has been declined*/
|
||||
};
|
||||
|
||||
typedef enum _LinphoneReason LinphoneReason;
|
||||
|
||||
const char *linphone_reason_to_string(LinphoneReason err);
|
||||
|
||||
/**
|
||||
* The LinphoneCall object represents a call issued or received by the LinphoneCore
|
||||
**/
|
||||
|
|
@ -163,24 +202,27 @@ typedef struct _LinphoneCall LinphoneCall;
|
|||
|
||||
typedef enum _LinphoneCallState{
|
||||
LinphoneCallIdle,
|
||||
LinphoneCallIncomingReceived,
|
||||
LinphoneCallOutgoingInit,
|
||||
LinphoneCallOutgoingProgress,
|
||||
LinphoneCallOutgoingRinging,
|
||||
LinphoneCallOutgoingEarlyMedia,
|
||||
LinphoneCallConnected,
|
||||
LinphoneCallStreamsRunning,
|
||||
LinphoneCallPausing,
|
||||
LinphoneCallPaused,
|
||||
LinphoneCallResuming,
|
||||
LinphoneCallRefered,
|
||||
LinphoneCallError,
|
||||
LinphoneCallEnd,
|
||||
LinphoneCallPausedByRemote
|
||||
LinphoneCallIncomingReceived, /**<This is a new incoming call */
|
||||
LinphoneCallOutgoingInit, /**<An outgoing call is started */
|
||||
LinphoneCallOutgoingProgress, /**<An outgoing call is in progress */
|
||||
LinphoneCallOutgoingRinging, /**<An outgoing call is ringing at remote end */
|
||||
LinphoneCallOutgoingEarlyMedia, /**<An outgoing call is proposed early media */
|
||||
LinphoneCallConnected, /**<Connected, the call is answered */
|
||||
LinphoneCallStreamsRunning, /**<The media streams are established and running*/
|
||||
LinphoneCallPausing, /**<The call is pausing at the initiative of local end */
|
||||
LinphoneCallPaused, /**< The call is paused, remote end has accepted the pause */
|
||||
LinphoneCallResuming, /**<The call is being resumed by local end*/
|
||||
LinphoneCallRefered, /**<The call is being transfered to another party, resulting in a new outgoing call to follow immediately*/
|
||||
LinphoneCallError, /**<The call encountered an error*/
|
||||
LinphoneCallEnd, /**<The call ended normally*/
|
||||
LinphoneCallPausedByRemote, /**<The call is paused by remote end*/
|
||||
LinphoneCallUpdatedByRemote /**<The call's parameters are updated, used for example when video is asked by remote */
|
||||
} LinphoneCallState;
|
||||
|
||||
const char *linphone_call_state_to_string(LinphoneCallState cs);
|
||||
|
||||
enum _LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
|
||||
|
||||
LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
|
||||
bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
|
||||
const LinphoneAddress * linphone_core_get_current_call_remote_address(struct _LinphoneCore *lc);
|
||||
const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call);
|
||||
|
|
@ -192,56 +234,15 @@ LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call);
|
|||
const char *linphone_call_get_refer_to(const LinphoneCall *call);
|
||||
bool_t linphone_call_has_transfer_pending(const LinphoneCall *call);
|
||||
int linphone_call_get_duration(const LinphoneCall *call);
|
||||
const LinphoneCallParams * linphone_call_get_current_params(const LinphoneCall *call);
|
||||
void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled);
|
||||
bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
|
||||
int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file);
|
||||
LinphoneReason linphone_call_get_reason(const LinphoneCall *call);
|
||||
const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
|
||||
void *linphone_call_get_user_pointer(LinphoneCall *call);
|
||||
void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
|
||||
|
||||
typedef enum{
|
||||
LinphoneSPWait,
|
||||
LinphoneSPDeny,
|
||||
LinphoneSPAccept
|
||||
}LinphoneSubscribePolicy;
|
||||
|
||||
typedef enum _LinphoneOnlineStatus{
|
||||
LinphoneStatusOffline,
|
||||
LinphoneStatusOnline,
|
||||
LinphoneStatusBusy,
|
||||
LinphoneStatusBeRightBack,
|
||||
LinphoneStatusAway,
|
||||
LinphoneStatusOnThePhone,
|
||||
LinphoneStatusOutToLunch,
|
||||
LinphoneStatusDoNotDisturb,
|
||||
LinphoneStatusMoved,
|
||||
LinphoneStatusAltService,
|
||||
LinphoneStatusPending,
|
||||
LinphoneStatusEnd
|
||||
}LinphoneOnlineStatus;
|
||||
|
||||
const char *linphone_online_status_to_string(LinphoneOnlineStatus ss);
|
||||
|
||||
struct _LinphoneFriend;
|
||||
|
||||
typedef struct _LinphoneFriend LinphoneFriend;
|
||||
|
||||
LinphoneFriend * linphone_friend_new();
|
||||
LinphoneFriend *linphone_friend_new_with_addr(const char *addr);
|
||||
int linphone_friend_set_sip_addr(LinphoneFriend *fr, const char *uri);
|
||||
int linphone_friend_set_name(LinphoneFriend *fr, const char *name);
|
||||
int linphone_friend_send_subscribe(LinphoneFriend *fr, bool_t val);
|
||||
int linphone_friend_set_inc_subscribe_policy(LinphoneFriend *fr, LinphoneSubscribePolicy pol);
|
||||
void linphone_friend_edit(LinphoneFriend *fr);
|
||||
void linphone_friend_done(LinphoneFriend *fr);
|
||||
void linphone_friend_destroy(LinphoneFriend *lf);
|
||||
const LinphoneAddress *linphone_friend_get_address(const LinphoneFriend *lf);
|
||||
bool_t linphone_friend_get_send_subscribe(const LinphoneFriend *lf);
|
||||
LinphoneSubscribePolicy linphone_friend_get_inc_subscribe_policy(const LinphoneFriend *lf);
|
||||
LinphoneOnlineStatus linphone_friend_get_status(const LinphoneFriend *lf);
|
||||
BuddyInfo * linphone_friend_get_info(const LinphoneFriend *lf);
|
||||
void linphone_friend_set_ref_key(LinphoneFriend *lf, const char *key);
|
||||
const char *linphone_friend_get_ref_key(const LinphoneFriend *lf);
|
||||
bool_t linphone_friend_in_list(const LinphoneFriend *lf);
|
||||
|
||||
#define linphone_friend_url(lf) ((lf)->url)
|
||||
|
||||
|
||||
/**
|
||||
* @addtogroup proxies
|
||||
|
|
@ -265,11 +266,34 @@ bool_t linphone_friend_in_list(const LinphoneFriend *lf);
|
|||
**/
|
||||
typedef struct _LinphoneProxyConfig LinphoneProxyConfig;
|
||||
|
||||
/**
|
||||
* LinphoneRegistrationState describes proxy registration states.
|
||||
**/
|
||||
typedef enum _LinphoneRegistrationState{
|
||||
LinphoneRegistrationNone,
|
||||
LinphoneRegistrationProgress,
|
||||
LinphoneRegistrationOk,
|
||||
LinphoneRegistrationCleared,
|
||||
LinphoneRegistrationFailed
|
||||
}LinphoneRegistrationState;
|
||||
|
||||
/**
|
||||
* Human readable version of the #LinphoneRegistrationState
|
||||
* @param cs sate
|
||||
*/
|
||||
const char *linphone_registration_state_to_string(LinphoneRegistrationState cs);
|
||||
|
||||
LinphoneProxyConfig *linphone_proxy_config_new(void);
|
||||
int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char *server_addr);
|
||||
int linphone_proxy_config_set_identity(LinphoneProxyConfig *obj, const char *identity);
|
||||
int linphone_proxy_config_set_route(LinphoneProxyConfig *obj, const char *route);
|
||||
void linphone_proxy_config_expires(LinphoneProxyConfig *obj, int expires);
|
||||
/**
|
||||
* Indicates either or not, REGISTRATION must be issued for this #LinphoneProxyConfig .
|
||||
* <br> In case this #LinphoneProxyConfig has been added to #LinphoneCore, follows the linphone_proxy_config_edit() rule.
|
||||
* @param obj object pointer
|
||||
* @param val if true, registration will be engaged
|
||||
*/
|
||||
void linphone_proxy_config_enable_register(LinphoneProxyConfig *obj, bool_t val);
|
||||
#define linphone_proxy_config_enableregister linphone_proxy_config_enable_register
|
||||
void linphone_proxy_config_edit(LinphoneProxyConfig *obj);
|
||||
|
|
@ -278,6 +302,7 @@ void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val);
|
|||
void linphone_proxy_config_set_dial_escape_plus(LinphoneProxyConfig *cfg, bool_t val);
|
||||
void linphone_proxy_config_set_dial_prefix(LinphoneProxyConfig *cfg, const char *prefix);
|
||||
|
||||
LinphoneRegistrationState linphone_proxy_config_get_state(const LinphoneProxyConfig *obj);
|
||||
bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj);
|
||||
const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg);
|
||||
|
||||
|
|
@ -292,6 +317,8 @@ struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig
|
|||
bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg);
|
||||
const char * linphone_proxy_config_get_dial_prefix(const LinphoneProxyConfig *cfg);
|
||||
|
||||
LinphoneReason linphone_proxy_config_get_error(const LinphoneProxyConfig *cfg);
|
||||
|
||||
/* destruction is called automatically when removing the proxy config */
|
||||
void linphone_proxy_config_destroy(LinphoneProxyConfig *cfg);
|
||||
void linphone_proxy_config_set_sip_setup(LinphoneProxyConfig *cfg, const char *type);
|
||||
|
|
@ -375,15 +402,50 @@ const char *linphone_auth_info_get_userid(const LinphoneAuthInfo *i);
|
|||
void linphone_auth_info_destroy(LinphoneAuthInfo *info);
|
||||
LinphoneAuthInfo * linphone_auth_info_new_from_config_file(struct _LpConfig *config, int pos);
|
||||
|
||||
struct _LinphoneChatRoom;
|
||||
typedef struct _LinphoneChatRoom LinphoneChatRoom;
|
||||
|
||||
LinphoneChatRoom * linphone_core_create_chat_room(struct _LinphoneCore *lc, const char *to);
|
||||
void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg);
|
||||
struct _LinphoneChatRoom;
|
||||
/**
|
||||
* @addtogroup chatroom
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* A chat room is the place where text messages are exchanged.
|
||||
* <br> Can be created by linphone_core_create_chat_room().
|
||||
*/
|
||||
typedef struct _LinphoneChatRoom LinphoneChatRoom;
|
||||
/**
|
||||
* Create a new chat room for messaging from a sip uri like sip:joe@sip.linphone.org
|
||||
* @param lc #LinphoneCore object
|
||||
* @param to destination address for messages
|
||||
* @return #LinphoneChatRoom where messaging can take place.
|
||||
*/
|
||||
LinphoneChatRoom * linphone_core_create_chat_room(LinphoneCore *lc, const char *to);
|
||||
/**
|
||||
* Destructor
|
||||
* @param cr #LinphoneChatRoom object
|
||||
*/
|
||||
void linphone_chat_room_destroy(LinphoneChatRoom *cr);
|
||||
|
||||
|
||||
/**
|
||||
* get peer address \link linphone_core_create_chat_room() associated to \endlink this #LinphoneChatRoom
|
||||
* @param cr #LinphoneChatRoom object
|
||||
* @return #LinphoneAddress peer address
|
||||
*/
|
||||
const LinphoneAddress* linphone_chat_room_get_peer_address(LinphoneChatRoom *cr);
|
||||
/**
|
||||
* send a message to peer member of this chat room.
|
||||
* @param cr #LinphoneChatRoom object
|
||||
* @param msg message to be sent
|
||||
*/
|
||||
void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg);
|
||||
|
||||
void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void * ud);
|
||||
void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
typedef enum _LinphoneGlobalState{
|
||||
LinphoneGlobalOff,
|
||||
LinphoneGlobalStartup,
|
||||
|
|
@ -391,13 +453,7 @@ typedef enum _LinphoneGlobalState{
|
|||
LinphoneGlobalShutdown
|
||||
}LinphoneGlobalState;
|
||||
|
||||
typedef enum _LinphoneRegistrationState{
|
||||
LinphoneRegistrationNone,
|
||||
LinphoneRegistrationProgress,
|
||||
LinphoneRegistrationOk,
|
||||
LinphoneRegistrationCleared,
|
||||
LinphoneRegistrationFailed
|
||||
}LinphoneRegistrationState;
|
||||
const char *linphone_global_state_to_string(LinphoneGlobalState gs);
|
||||
|
||||
/**
|
||||
* @addtogroup initializing
|
||||
|
|
@ -409,7 +465,9 @@ typedef enum _LinphoneRegistrationState{
|
|||
typedef void (*LinphoneGlobalStateCb)(struct _LinphoneCore *lc, LinphoneGlobalState gstate, const char *message);
|
||||
/**Call state notification callback prototype*/
|
||||
typedef void (*LinphoneCallStateCb)(struct _LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message);
|
||||
/**Registration state notification callback prototype*/
|
||||
/** @ingroup Proxies
|
||||
* Registration state notification callback prototype
|
||||
* */
|
||||
typedef void (*LinphoneRegistrationStateCb)(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message);
|
||||
/** Callback prototype */
|
||||
typedef void (*ShowInterfaceCb)(struct _LinphoneCore *lc);
|
||||
|
|
@ -423,16 +481,34 @@ typedef void (*DisplayUrlCb)(struct _LinphoneCore *lc, const char *message, cons
|
|||
typedef void (*LinphoneCoreCbFunc)(struct _LinphoneCore *lc,void * user_data);
|
||||
/** Callback prototype */
|
||||
typedef void (*NotifyReceivedCb)(struct _LinphoneCore *lc, LinphoneCall *call, const char *from, const char *event);
|
||||
/** Callback prototype */
|
||||
typedef void (*NotifyPresenceReceivedCb)(struct _LinphoneCore *lc, LinphoneFriend * fid);
|
||||
/** Callback prototype */
|
||||
typedef void (*NewUnknownSubscriberCb)(struct _LinphoneCore *lc, LinphoneFriend *lf, const char *url);
|
||||
/**
|
||||
* Report status change for a friend previously \link linphone_core_add_friend() added \endlink to #LinphoneCore.
|
||||
* @param lc #LinphoneCore object .
|
||||
* @param lf Updated #LinphoneFriend .
|
||||
*/
|
||||
typedef void (*NotifyPresenceReceivedCb)(struct _LinphoneCore *lc, LinphoneFriend * lf);
|
||||
/**
|
||||
* Reports that a new subscription request has been received and wait for a decision.
|
||||
* <br> Status on this subscription request is notified by \link linphone_friend_set_inc_subscribe_policy() changing policy \endlink for this friend
|
||||
* @param lc #LinphoneCore object
|
||||
* @param lf #LinphoneFriend corresponding to the subscriber
|
||||
* @param url of the subscriber
|
||||
* Callback prototype
|
||||
* */
|
||||
typedef void (*NewSubscribtionRequestCb)(struct _LinphoneCore *lc, LinphoneFriend *lf, const char *url);
|
||||
/** Callback prototype */
|
||||
typedef void (*AuthInfoRequested)(struct _LinphoneCore *lc, const char *realm, const char *username);
|
||||
/** Callback prototype */
|
||||
typedef void (*CallLogUpdated)(struct _LinphoneCore *lc, struct _LinphoneCallLog *newcl);
|
||||
/** Callback prototype */
|
||||
typedef void (*TextMessageReceived)(struct _LinphoneCore *lc, LinphoneChatRoom *room, const char *from, const char *message);
|
||||
/**
|
||||
* Callback prototype
|
||||
*
|
||||
* @param lc #LinphoneCore object
|
||||
* @param room #LinphoneChatRoom involved in this conversation. Can be be created by the framework in case \link #LinphoneAddress the from \endlink is not present in any chat room.
|
||||
* @param from #LinphoneAddress from
|
||||
* @param message incoming message
|
||||
* */
|
||||
typedef void (*TextMessageReceived)(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message);
|
||||
/** Callback prototype */
|
||||
typedef void (*DtmfReceived)(struct _LinphoneCore* lc, LinphoneCall *call, int dtmf);
|
||||
/** Callback prototype */
|
||||
|
|
@ -449,7 +525,7 @@ typedef struct _LinphoneVTable{
|
|||
LinphoneRegistrationStateCb registration_state_changed;/**<Notifies registration state changes*/
|
||||
LinphoneCallStateCb call_state_changed;/**<Notifies call state changes*/
|
||||
NotifyPresenceReceivedCb notify_presence_recv; /**< Notify received presence events*/
|
||||
NewUnknownSubscriberCb new_unknown_subscriber; /**< Notify about unknown subscriber */
|
||||
NewSubscribtionRequestCb new_subscription_request; /**< Notify about pending subscription request */
|
||||
AuthInfoRequested auth_info_requested; /**< Ask the application some authentication information */
|
||||
CallLogUpdated call_log_updated; /**< Notifies that call log list has been updated */
|
||||
TextMessageReceived text_received; /**< A text message has been received */
|
||||
|
|
@ -489,7 +565,6 @@ typedef enum _LinphoneWaitingState{
|
|||
} LinphoneWaitingState;
|
||||
typedef void * (*LinphoneWaitingCallback)(struct _LinphoneCore *lc, void *context, LinphoneWaitingState ws, const char *purpose, float progress);
|
||||
|
||||
typedef struct _LinphoneCore LinphoneCore;
|
||||
|
||||
/* THE main API */
|
||||
|
||||
|
|
@ -512,8 +587,14 @@ LinphoneCall * linphone_core_invite(LinphoneCore *lc, const char *url);
|
|||
|
||||
LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddress *addr);
|
||||
|
||||
LinphoneCall * linphone_core_invite_with_params(LinphoneCore *lc, const char *url, const LinphoneCallParams *params);
|
||||
|
||||
LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const LinphoneAddress *addr, const LinphoneCallParams *params);
|
||||
|
||||
int linphone_core_transfer_call(LinphoneCore *lc, LinphoneCall *call, const char *refer_to);
|
||||
|
||||
int linphone_core_transfer_call_to_another(LinphoneCore *lc, LinphoneCall *call, LinphoneCall *dest);
|
||||
|
||||
bool_t linphone_core_inc_invite_pending(LinphoneCore*lc);
|
||||
|
||||
bool_t linphone_core_in_call(const LinphoneCore *lc);
|
||||
|
|
@ -532,6 +613,10 @@ int linphone_core_pause_all_calls(LinphoneCore *lc);
|
|||
|
||||
int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call);
|
||||
|
||||
int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, LinphoneCallParams *params);
|
||||
|
||||
LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *lc);
|
||||
|
||||
LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const char *remote_address);
|
||||
|
||||
void linphone_core_send_dtmf(LinphoneCore *lc,char dtmf);
|
||||
|
|
@ -540,6 +625,8 @@ int linphone_core_set_primary_contact(LinphoneCore *lc, const char *contact);
|
|||
|
||||
const char *linphone_core_get_primary_contact(LinphoneCore *lc);
|
||||
|
||||
const char * linphone_core_get_identity(LinphoneCore *lc);
|
||||
|
||||
void linphone_core_set_guess_hostname(LinphoneCore *lc, bool_t val);
|
||||
bool_t linphone_core_get_guess_hostname(LinphoneCore *lc);
|
||||
|
||||
|
|
@ -547,7 +634,7 @@ bool_t linphone_core_ipv6_enabled(LinphoneCore *lc);
|
|||
void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val);
|
||||
|
||||
LinphoneAddress *linphone_core_get_primary_contact_parsed(LinphoneCore *lc);
|
||||
|
||||
const char * linphone_core_get_identity(LinphoneCore *lc);
|
||||
/*0= no bandwidth limit*/
|
||||
void linphone_core_set_download_bandwidth(LinphoneCore *lc, int bw);
|
||||
void linphone_core_set_upload_bandwidth(LinphoneCore *lc, int bw);
|
||||
|
|
@ -692,6 +779,8 @@ void linphone_core_set_ring(LinphoneCore *lc, const char *path);
|
|||
const char *linphone_core_get_ring(const LinphoneCore *lc);
|
||||
void linphone_core_set_ringback(LinphoneCore *lc, const char *path);
|
||||
const char * linphone_core_get_ringback(const LinphoneCore *lc);
|
||||
void linphone_core_set_remote_ringback_tone(LinphoneCore *lc,const char *);
|
||||
const char *linphone_core_get_remote_ringback_tone(const LinphoneCore *lc);
|
||||
int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCbFunc func,void * userdata);
|
||||
void linphone_core_enable_echo_cancellation(LinphoneCore *lc, bool_t val);
|
||||
bool_t linphone_core_echo_cancellation_enabled(LinphoneCore *lc);
|
||||
|
|
@ -716,20 +805,6 @@ bool_t linphone_core_is_rtp_muted(LinphoneCore *lc);
|
|||
bool_t linphone_core_get_rtp_no_xmit_on_audio_mute(const LinphoneCore *lc);
|
||||
void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, bool_t val);
|
||||
|
||||
void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away,const char *contact,LinphoneOnlineStatus os);
|
||||
|
||||
LinphoneOnlineStatus linphone_core_get_presence_info(const LinphoneCore *lc);
|
||||
|
||||
void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char **result);
|
||||
void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *fr);
|
||||
void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend *fr);
|
||||
void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneFriend *lf);
|
||||
/* a list of LinphoneFriend */
|
||||
const MSList * linphone_core_get_friend_list(const LinphoneCore *lc);
|
||||
/* notify all friends that have subscribed */
|
||||
void linphone_core_notify_all_friends(LinphoneCore *lc, LinphoneOnlineStatus os);
|
||||
LinphoneFriend *linphone_core_get_friend_by_address(const LinphoneCore *lc, const char *addr);
|
||||
LinphoneFriend *linphone_core_get_friend_by_ref_key(const LinphoneCore *lc, const char *key);
|
||||
|
||||
/* returns a list of LinphoneCallLog */
|
||||
const MSList * linphone_core_get_call_logs(LinphoneCore *lc);
|
||||
|
|
@ -770,7 +845,12 @@ float linphone_core_get_static_picture_fps(LinphoneCore *lc);
|
|||
|
||||
/*function to be used for eventually setting window decorations (icons, title...)*/
|
||||
unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc);
|
||||
void linphone_core_set_native_video_window_id(LinphoneCore *lc, unsigned long id);
|
||||
|
||||
unsigned long linphone_core_get_native_preview_window_id(const LinphoneCore *lc);
|
||||
void linphone_core_set_native_preview_window_id(LinphoneCore *lc, unsigned long id);
|
||||
|
||||
void linphone_core_use_preview_window(LinphoneCore *lc, bool_t yesno);
|
||||
|
||||
/*play/record support: use files instead of soundcard*/
|
||||
void linphone_core_use_files(LinphoneCore *lc, bool_t yesno);
|
||||
|
|
@ -780,9 +860,8 @@ void linphone_core_set_record_file(LinphoneCore *lc, const char *file);
|
|||
void linphone_core_play_dtmf(LinphoneCore *lc, char dtmf, int duration_ms);
|
||||
void linphone_core_stop_dtmf(LinphoneCore *lc);
|
||||
|
||||
|
||||
int linphone_core_get_current_call_duration(const LinphoneCore *lc);
|
||||
const LinphoneAddress *linphone_core_get_remote_address(LinphoneCore *lc);
|
||||
|
||||
|
||||
int linphone_core_get_mtu(const LinphoneCore *lc);
|
||||
void linphone_core_set_mtu(LinphoneCore *lc, int mtu);
|
||||
|
|
@ -830,6 +909,8 @@ int linphone_core_get_current_call_stats(LinphoneCore *lc, rtp_stats_t *local, r
|
|||
|
||||
const MSList *linphone_core_get_calls(LinphoneCore *lc);
|
||||
|
||||
LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ extern "C" void libmsilbc_init();
|
|||
#endif /*ANDROID*/
|
||||
|
||||
extern "C" void ms_andsnd_set_jvm(JavaVM *jvm) ;
|
||||
extern "C" void ms_andvid_set_jvm(JavaVM *jvm) ;
|
||||
|
||||
static JavaVM *jvm=0;
|
||||
|
||||
#ifdef ANDROID
|
||||
|
|
@ -45,6 +47,9 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *ajvm, void *reserved)
|
|||
{
|
||||
#ifdef ANDROID
|
||||
ms_andsnd_set_jvm(ajvm);
|
||||
#ifdef VIDEO_ENABLED
|
||||
ms_andvid_set_jvm(ajvm);
|
||||
#endif /*VIDEO_ENABLED*/
|
||||
#endif /*ANDROID*/
|
||||
jvm=ajvm;
|
||||
return JNI_VERSION_1_2;
|
||||
|
|
@ -79,6 +84,9 @@ public:
|
|||
vTable.global_state_changed = globalStateChange;
|
||||
vTable.registration_state_changed = registrationStateChange;
|
||||
vTable.call_state_changed = callStateChange;
|
||||
vTable.text_received = text_received;
|
||||
vTable.new_subscription_request = new_subscription_request;
|
||||
vTable.notify_presence_recv = notify_presence_recv;
|
||||
|
||||
listernerClass = (jclass)env->NewGlobalRef(env->GetObjectClass( alistener));
|
||||
/*displayStatus(LinphoneCore lc,String message);*/
|
||||
|
|
@ -96,12 +104,30 @@ public:
|
|||
callStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCall$State"));
|
||||
callStateFromIntId = env->GetStaticMethodID(callStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCall$State;");
|
||||
|
||||
/*void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url)*/
|
||||
newSubscriptionRequestId = env->GetMethodID(listernerClass,"newSubscriptionRequest","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;Ljava/lang/String;)V");
|
||||
|
||||
/*void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf);*/
|
||||
notifyPresenceReceivedId = env->GetMethodID(listernerClass,"notifyPresenceReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;)V");
|
||||
|
||||
/*void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message);*/
|
||||
textReceivedId = env->GetMethodID(listernerClass,"textReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneAddress;Ljava/lang/String;)V");
|
||||
|
||||
proxyClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneProxyConfigImpl"));
|
||||
proxyCtrId = env->GetMethodID(proxyClass,"<init>", "(J)V");
|
||||
|
||||
callClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCallImpl"));
|
||||
callCtrId = env->GetMethodID(callClass,"<init>", "(J)V");
|
||||
|
||||
chatRoomClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneChatRoomImpl"));
|
||||
chatRoomCtrId = env->GetMethodID(chatRoomClass,"<init>", "(J)V");
|
||||
|
||||
friendClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneFriendImpl"));;
|
||||
friendCtrId =env->GetMethodID(friendClass,"<init>", "(J)V");
|
||||
|
||||
addressClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneAddressImpl"));
|
||||
addressCtrId =env->GetMethodID(addressClass,"<init>", "(J)V");
|
||||
|
||||
}
|
||||
|
||||
~LinphoneCoreData() {
|
||||
|
|
@ -116,6 +142,8 @@ public:
|
|||
env->DeleteGlobalRef(callStateClass);
|
||||
env->DeleteGlobalRef(proxyClass);
|
||||
env->DeleteGlobalRef(callClass);
|
||||
env->DeleteGlobalRef(chatRoomClass);
|
||||
env->DeleteGlobalRef(friendClass);
|
||||
|
||||
}
|
||||
jobject core;
|
||||
|
|
@ -124,6 +152,9 @@ public:
|
|||
|
||||
jclass listernerClass;
|
||||
jmethodID displayStatusId;
|
||||
jmethodID newSubscriptionRequestId;
|
||||
jmethodID notifyPresenceReceivedId;
|
||||
jmethodID textReceivedId;
|
||||
|
||||
jclass globalStateClass;
|
||||
jmethodID globalStateId;
|
||||
|
|
@ -143,6 +174,15 @@ public:
|
|||
jclass callClass;
|
||||
jmethodID callCtrId;
|
||||
|
||||
jclass chatRoomClass;
|
||||
jmethodID chatRoomCtrId;
|
||||
|
||||
jclass friendClass;
|
||||
jmethodID friendCtrId;
|
||||
|
||||
jclass addressClass;
|
||||
jmethodID addressCtrId;
|
||||
|
||||
LinphoneCoreVTable vTable;
|
||||
|
||||
static void showInterfaceCb(LinphoneCore *lc) {
|
||||
|
|
@ -211,6 +251,48 @@ public:
|
|||
,env->CallStaticObjectMethod(lcData->callStateClass,lcData->callStateFromIntId,(jint)state),
|
||||
message ? env->NewStringUTF(message) : NULL);
|
||||
}
|
||||
static void notify_presence_recv (LinphoneCore *lc, LinphoneFriend *my_friend) {
|
||||
JNIEnv *env = 0;
|
||||
jint result = jvm->AttachCurrentThread(&env,NULL);
|
||||
if (result != 0) {
|
||||
ms_error("cannot attach VM\n");
|
||||
return;
|
||||
}
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
|
||||
env->CallVoidMethod(lcData->listener
|
||||
,lcData->notifyPresenceReceivedId
|
||||
,lcData->core
|
||||
,env->NewObject(lcData->friendClass,lcData->friendCtrId,(jlong)my_friend));
|
||||
}
|
||||
static void new_subscription_request (LinphoneCore *lc, LinphoneFriend *my_friend, const char* url) {
|
||||
JNIEnv *env = 0;
|
||||
jint result = jvm->AttachCurrentThread(&env,NULL);
|
||||
if (result != 0) {
|
||||
ms_error("cannot attach VM\n");
|
||||
return;
|
||||
}
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
|
||||
env->CallVoidMethod(lcData->listener
|
||||
,lcData->newSubscriptionRequestId
|
||||
,lcData->core
|
||||
,env->NewObject(lcData->friendClass,lcData->friendCtrId,(jlong)my_friend)
|
||||
,url ? env->NewStringUTF(url) : NULL);
|
||||
}
|
||||
static void text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message) {
|
||||
JNIEnv *env = 0;
|
||||
jint result = jvm->AttachCurrentThread(&env,NULL);
|
||||
if (result != 0) {
|
||||
ms_error("cannot attach VM\n");
|
||||
return;
|
||||
}
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
|
||||
env->CallVoidMethod(lcData->listener
|
||||
,lcData->textReceivedId
|
||||
,lcData->core
|
||||
,env->NewObject(lcData->chatRoomClass,lcData->chatRoomCtrId,(jlong)room)
|
||||
,env->NewObject(lcData->addressClass,lcData->addressCtrId,(jlong)from)
|
||||
,message ? env->NewStringUTF(message) : NULL);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
|
@ -221,8 +303,8 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv*
|
|||
,jstring jfactoryConfig
|
||||
,jobject juserdata){
|
||||
|
||||
const char* userConfig = env->GetStringUTFChars(juserConfig, NULL);
|
||||
const char* factoryConfig = env->GetStringUTFChars(jfactoryConfig, NULL);
|
||||
const char* userConfig = juserConfig?env->GetStringUTFChars(juserConfig, NULL):NULL;
|
||||
const char* factoryConfig = jfactoryConfig?env->GetStringUTFChars(jfactoryConfig, NULL):NULL;
|
||||
LinphoneCoreData* ldata = new LinphoneCoreData(env,thiz,jlistener,juserdata);
|
||||
#ifdef ANDROID
|
||||
ms_andsnd_set_jvm(jvm);
|
||||
|
|
@ -240,8 +322,8 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv*
|
|||
//clear existing proxy config
|
||||
linphone_core_clear_proxy_config((LinphoneCore*) nativePtr);
|
||||
|
||||
env->ReleaseStringUTFChars(juserConfig, userConfig);
|
||||
env->ReleaseStringUTFChars(jfactoryConfig, factoryConfig);
|
||||
if (userConfig) env->ReleaseStringUTFChars(juserConfig, userConfig);
|
||||
if (factoryConfig) env->ReleaseStringUTFChars(jfactoryConfig, factoryConfig);
|
||||
return nativePtr;
|
||||
}
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_delete(JNIEnv* env
|
||||
|
|
@ -456,7 +538,48 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCurrentCall(JNIEnv*
|
|||
) {
|
||||
return (jlong)linphone_core_get_current_call((LinphoneCore*)lc);
|
||||
}
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addFriend(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong lc
|
||||
,jlong aFriend
|
||||
) {
|
||||
linphone_core_add_friend((LinphoneCore*)lc,(LinphoneFriend*)aFriend);
|
||||
}
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPresenceInfo(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong lc
|
||||
,jint minute_away
|
||||
,jstring jalternative_contact
|
||||
,jint status) {
|
||||
const char* alternative_contact = jalternative_contact?env->GetStringUTFChars(jalternative_contact, NULL):NULL;
|
||||
linphone_core_set_presence_info((LinphoneCore*)lc,minute_away,alternative_contact,(LinphoneOnlineStatus)status);
|
||||
if (alternative_contact) env->ReleaseStringUTFChars(jalternative_contact, alternative_contact);
|
||||
}
|
||||
|
||||
extern "C" long Java_org_linphone_core_LinphoneCoreImpl_createChatRoom(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong lc
|
||||
,jstring jto) {
|
||||
|
||||
const char* to = env->GetStringUTFChars(jto, NULL);
|
||||
LinphoneChatRoom* lResult = linphone_core_create_chat_room((LinphoneCore*)lc,to);
|
||||
env->ReleaseStringUTFChars(jto, to);
|
||||
return (long)lResult;
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableVideo(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong lc
|
||||
,jboolean vcap_enabled
|
||||
,jboolean display_enabled) {
|
||||
linphone_core_enable_video((LinphoneCore*)lc, vcap_enabled,display_enabled);
|
||||
|
||||
}
|
||||
extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isVideoEnabled(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong lc) {
|
||||
return linphone_core_video_enabled((LinphoneCore*)lc);
|
||||
}
|
||||
|
||||
//ProxyConfig
|
||||
|
||||
|
|
@ -496,10 +619,14 @@ extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getProxy(JNIEn
|
|||
}
|
||||
}
|
||||
extern "C" int Java_org_linphone_core_LinphoneProxyConfigImpl_setRoute(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jroute) {
|
||||
const char* route = env->GetStringUTFChars(jroute, NULL);
|
||||
int err=linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,route);
|
||||
env->ReleaseStringUTFChars(jroute, route);
|
||||
return err;
|
||||
if (jroute != NULL) {
|
||||
const char* route = env->GetStringUTFChars(jroute, NULL);
|
||||
int err=linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,route);
|
||||
env->ReleaseStringUTFChars(jroute, route);
|
||||
return err;
|
||||
} else {
|
||||
return linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,NULL);
|
||||
}
|
||||
}
|
||||
extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getRoute(JNIEnv* env,jobject thiz,jlong proxyCfg) {
|
||||
const char* route = linphone_proxy_config_get_route((LinphoneProxyConfig*)proxyCfg);
|
||||
|
|
@ -737,6 +864,114 @@ extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getState( JNIEnv* env
|
|||
return (jint)linphone_call_get_state((LinphoneCall*)ptr);
|
||||
}
|
||||
|
||||
//LinphoneFriend
|
||||
extern "C" long Java_org_linphone_core_LinphoneFriendImpl_newLinphoneFriend(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jstring jFriendUri) {
|
||||
LinphoneFriend* lResult;
|
||||
|
||||
if (jFriendUri) {
|
||||
const char* friendUri = env->GetStringUTFChars(jFriendUri, NULL);
|
||||
lResult= linphone_friend_new_with_addr(friendUri);
|
||||
env->ReleaseStringUTFChars(jFriendUri, friendUri);
|
||||
} else {
|
||||
lResult = linphone_friend_new();
|
||||
}
|
||||
return (long)lResult;
|
||||
}
|
||||
extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setAddress(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr
|
||||
,jlong linphoneAddress) {
|
||||
linphone_friend_set_addr((LinphoneFriend*)ptr,(LinphoneAddress*)linphoneAddress);
|
||||
}
|
||||
extern "C" long Java_org_linphone_core_LinphoneFriendImpl_getAddress(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
return (long)linphone_friend_get_address((LinphoneFriend*)ptr);
|
||||
}
|
||||
extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setIncSubscribePolicy(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr
|
||||
,jint policy) {
|
||||
linphone_friend_set_inc_subscribe_policy((LinphoneFriend*)ptr,(LinphoneSubscribePolicy)policy);
|
||||
}
|
||||
extern "C" jint Java_org_linphone_core_LinphoneFriendImpl_getIncSubscribePolicy(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
return linphone_friend_get_inc_subscribe_policy((LinphoneFriend*)ptr);
|
||||
}
|
||||
extern "C" void Java_org_linphone_core_LinphoneFriendImpl_enableSubscribes(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr
|
||||
,jboolean value) {
|
||||
linphone_friend_enable_subscribes((LinphoneFriend*)ptr,value);
|
||||
}
|
||||
extern "C" jboolean Java_org_linphone_core_LinphoneFriendImpl_isSubscribesEnabled(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
return linphone_friend_subscribes_enabled((LinphoneFriend*)ptr);
|
||||
}
|
||||
extern "C" jboolean Java_org_linphone_core_LinphoneFriendImpl_getStatus(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
return linphone_friend_get_status((LinphoneFriend*)ptr);
|
||||
}
|
||||
extern "C" void Java_org_linphone_core_LinphoneFriendImpl_edit(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
return linphone_friend_edit((LinphoneFriend*)ptr);
|
||||
}
|
||||
extern "C" void Java_org_linphone_core_LinphoneFriendImpl_done(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
linphone_friend_done((LinphoneFriend*)ptr);
|
||||
}
|
||||
//LinphoneChatRoom
|
||||
extern "C" long Java_org_linphone_core_LinphoneChatRoomImpl_getPeerAddress(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
return (long) linphone_chat_room_get_peer_address((LinphoneChatRoom*)ptr);
|
||||
}
|
||||
extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendMessage(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr
|
||||
,jstring jmessage) {
|
||||
const char* message = env->GetStringUTFChars(jmessage, NULL);
|
||||
linphone_chat_room_send_message((LinphoneChatRoom*)ptr,message);
|
||||
env->ReleaseStringUTFChars(jmessage, message);
|
||||
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoWindowId(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong lc
|
||||
,jobject obj) {
|
||||
linphone_core_set_native_video_window_id((LinphoneCore*)lc,(unsigned long)obj);
|
||||
}
|
||||
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setFirewallPolicy(JNIEnv *env, jobject thiz, jlong lc, int enum_value){
|
||||
linphone_core_set_firewall_policy((LinphoneCore*)lc,(LinphoneFirewallPolicy)enum_value);
|
||||
}
|
||||
|
||||
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getFirewallPolicy(JNIEnv *env, jobject thiz, jlong lc){
|
||||
return linphone_core_get_firewall_policy((LinphoneCore*)lc);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setStunServer(JNIEnv *env, jobject thiz, jlong lc, jstring jserver){
|
||||
const char* server = NULL;
|
||||
if (jserver) server=env->GetStringUTFChars(jserver, NULL);
|
||||
linphone_core_set_stun_server((LinphoneCore*)lc,server);
|
||||
if (server) env->ReleaseStringUTFChars(jserver,server);
|
||||
}
|
||||
|
||||
extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getStunServer(JNIEnv *env, jobject thiz, jlong lc){
|
||||
const char *ret= linphone_core_get_stun_server((LinphoneCore*)lc);
|
||||
if (ret==NULL) return NULL;
|
||||
jstring jvalue =env->NewStringUTF(ret);
|
||||
return jvalue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
267
coreapi/linphonefriend.h
Normal file
267
coreapi/linphonefriend.h
Normal file
|
|
@ -0,0 +1,267 @@
|
|||
/*
|
||||
linphonefriend.h
|
||||
Copyright (C) 2010 Belledonne Communications SARL
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef LINPHONEFRIEND_H_
|
||||
#define LINPHONEFRIEND_H_
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/**
|
||||
* @addtogroup buddy_list
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @ingroup buddy_list
|
||||
* Enum controlling behavior for incoming subscription request.
|
||||
* <br> Use by linphone_friend_set_inc_subscribe_policy()
|
||||
*/
|
||||
typedef enum {
|
||||
/**
|
||||
* Does not automatically accept an incoming subscription request.
|
||||
* This policy implies that a decision has to be taken for each incoming subscription request notified by callback LinphoneCoreVTable.new_subscription_request
|
||||
*
|
||||
*/
|
||||
LinphoneSPWait,
|
||||
/**
|
||||
* Rejects incoming subscription request.
|
||||
*/
|
||||
LinphoneSPDeny,
|
||||
/**
|
||||
* Automatically accepts a subscription request.
|
||||
*/
|
||||
LinphoneSPAccept
|
||||
}LinphoneSubscribePolicy;
|
||||
|
||||
/**
|
||||
* Enum describing remote friend status
|
||||
*/
|
||||
typedef enum _LinphoneOnlineStatus{
|
||||
/**
|
||||
* Offline
|
||||
*/
|
||||
LinphoneStatusOffline,
|
||||
/**
|
||||
* Online
|
||||
*/
|
||||
LinphoneStatusOnline,
|
||||
/**
|
||||
* Busy
|
||||
*/
|
||||
LinphoneStatusBusy,
|
||||
/**
|
||||
* Be right back
|
||||
*/
|
||||
LinphoneStatusBeRightBack,
|
||||
/**
|
||||
* Away
|
||||
*/
|
||||
LinphoneStatusAway,
|
||||
/**
|
||||
* On the phone
|
||||
*/
|
||||
LinphoneStatusOnThePhone,
|
||||
/**
|
||||
* Out to lunch
|
||||
*/
|
||||
LinphoneStatusOutToLunch,
|
||||
/**
|
||||
* Do not disturb
|
||||
*/
|
||||
LinphoneStatusDoNotDisturb,
|
||||
/**
|
||||
* Moved in this sate, call can be redirected if an alternate contact address has been set using function linphone_core_set_presence_info()
|
||||
*/
|
||||
LinphoneStatusMoved,
|
||||
/**
|
||||
* Using another messaging service
|
||||
*/
|
||||
LinphoneStatusAltService,
|
||||
/**
|
||||
* Pending
|
||||
*/
|
||||
LinphoneStatusPending,
|
||||
|
||||
LinphoneStatusEnd
|
||||
}LinphoneOnlineStatus;
|
||||
|
||||
|
||||
struct _LinphoneFriend;
|
||||
/**
|
||||
* Represents a buddy, all presence actions like subscription and status change notification are performed on this object
|
||||
*/
|
||||
typedef struct _LinphoneFriend LinphoneFriend;
|
||||
|
||||
/**
|
||||
* Contructor
|
||||
* @return a new empty #LinphoneFriend
|
||||
*/
|
||||
LinphoneFriend * linphone_friend_new();
|
||||
/**
|
||||
* Contructor same as linphone_friend_new() + linphone_friend_set_addr()
|
||||
* @param addr a buddy address, must be a sip uri like sip:joe@sip.linphone.org
|
||||
* @return a new #LinphoneFriend with \link linphone_friend_get_address() address initialized \endlink
|
||||
*/
|
||||
LinphoneFriend *linphone_friend_new_with_addr(const char *addr);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
* @param lf #LinphoneFriend object
|
||||
*/
|
||||
void linphone_friend_destroy(LinphoneFriend *lf);
|
||||
|
||||
/**
|
||||
* set #LinphoneAddress for this friend
|
||||
* @param fr #LinphoneFriend object
|
||||
* @param address #LinphoneAddress
|
||||
*/
|
||||
int linphone_friend_set_addr(LinphoneFriend *fr, const LinphoneAddress* address);
|
||||
|
||||
/**
|
||||
* get address of this friend
|
||||
* @param lf #LinphoneFriend object
|
||||
* @return #LinphoneAddress
|
||||
*/
|
||||
const LinphoneAddress *linphone_friend_get_address(const LinphoneFriend *lf);
|
||||
/**
|
||||
* get subscription flag value
|
||||
* @param lf #LinphoneFriend object
|
||||
* @return returns true is subscription is activated for this friend
|
||||
*
|
||||
*/
|
||||
bool_t linphone_friend_subscribes_enabled(const LinphoneFriend *lf);
|
||||
#define linphone_friend_get_send_subscribe linphone_friend_subscribes_enabled
|
||||
|
||||
/**
|
||||
* Configure #LinphoneFriend to subscribe to presence information
|
||||
* @param fr #LinphoneFriend object
|
||||
* @param val if TRUE this friend will receive subscription message
|
||||
*/
|
||||
|
||||
int linphone_friend_enable_subscribes(LinphoneFriend *fr, bool_t val);
|
||||
|
||||
#define linphone_friend_send_subscribe linphone_friend_enable_subscribes
|
||||
/**
|
||||
* Configure incoming subscription policy for this friend.
|
||||
* @param fr #LinphoneFriend object
|
||||
* @param pol #LinphoneSubscribePolicy policy to apply.
|
||||
*/
|
||||
int linphone_friend_set_inc_subscribe_policy(LinphoneFriend *fr, LinphoneSubscribePolicy pol);
|
||||
/**
|
||||
* get current subscription policy for this #LinphoneFriend
|
||||
* @param lf #LinphoneFriend object
|
||||
* @return #LinphoneSubscribePolicy
|
||||
*
|
||||
*/
|
||||
LinphoneSubscribePolicy linphone_friend_get_inc_subscribe_policy(const LinphoneFriend *lf);
|
||||
|
||||
/**
|
||||
* Starts editing a friend configuration.
|
||||
*
|
||||
* Because friend configuration must be consistent, applications MUST
|
||||
* call linphone_friend_edit() before doing any attempts to modify
|
||||
* friend configuration (such as \link linphone_friend_set_addr() address \endlink or \link linphone_friend_set_inc_subscribe_policy() subscription policy\endlink and so on).
|
||||
* Once the modifications are done, then the application must call
|
||||
* linphone_friend_done() to commit the changes.
|
||||
**/
|
||||
void linphone_friend_edit(LinphoneFriend *fr);
|
||||
/**
|
||||
* Commits modification made to the friend configuration.
|
||||
* @param fr #LinphoneFriend object
|
||||
**/
|
||||
void linphone_friend_done(LinphoneFriend *fr);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* get friend status
|
||||
* @return #LinphoneOnlineStatus
|
||||
*/
|
||||
LinphoneOnlineStatus linphone_friend_get_status(const LinphoneFriend *lf);
|
||||
BuddyInfo * linphone_friend_get_info(const LinphoneFriend *lf);
|
||||
void linphone_friend_set_ref_key(LinphoneFriend *lf, const char *key);
|
||||
const char *linphone_friend_get_ref_key(const LinphoneFriend *lf);
|
||||
bool_t linphone_friend_in_list(const LinphoneFriend *lf);
|
||||
|
||||
#define linphone_friend_url(lf) ((lf)->url)
|
||||
|
||||
/**
|
||||
* return humain readable presence status
|
||||
* @param ss
|
||||
*/
|
||||
const char *linphone_online_status_to_string(LinphoneOnlineStatus ss);
|
||||
|
||||
|
||||
/**
|
||||
* Set my presence status
|
||||
* @param lc #LinphoneCore object
|
||||
* @param minutes_away how long in away
|
||||
* @param alternative_contact sip uri used to redirect call in state #LinphoneStatusMoved
|
||||
* @param os #LinphoneOnlineStatus
|
||||
*/
|
||||
void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away,const char *alternative_contact,LinphoneOnlineStatus os);
|
||||
/**
|
||||
* get my presence status
|
||||
* @param lc #LinphoneCore object
|
||||
* @return #LinphoneOnlineStatus
|
||||
*/
|
||||
LinphoneOnlineStatus linphone_core_get_presence_info(const LinphoneCore *lc);
|
||||
|
||||
void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char **result);
|
||||
/**
|
||||
* Add a friend to the current buddy list, if \link linphone_friend_enable_subscribes() subscription attribute \endlink is set, a SIP SUBSCRIBE message is sent.
|
||||
* @param lc #LinphoneCore object
|
||||
* @param fr #LinphoneFriend to add
|
||||
*/
|
||||
void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *fr);
|
||||
/**
|
||||
* remove a friend from the buddy list
|
||||
* @param lc #LinphoneCore object
|
||||
* @param fr #LinphoneFriend to add
|
||||
*/
|
||||
void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend *fr);
|
||||
/**
|
||||
* Black list a friend. same as linphone_friend_set_inc_subscribe_policy() with #LinphoneSPDeny policy;
|
||||
* @param lc #LinphoneCore object
|
||||
* @param lf #LinphoneFriend to add
|
||||
*/
|
||||
void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneFriend *lf);
|
||||
/**
|
||||
* get Buddy list of LinphoneFriend
|
||||
* @param lc #LinphoneCore object
|
||||
* */
|
||||
const MSList * linphone_core_get_friend_list(const LinphoneCore *lc);
|
||||
/**
|
||||
* notify all friends that have subscribed
|
||||
* @param lc #LinphoneCore object
|
||||
* @param os #LinphoneOnlineStatus to notify
|
||||
* */
|
||||
void linphone_core_notify_all_friends(LinphoneCore *lc, LinphoneOnlineStatus os);
|
||||
LinphoneFriend *linphone_core_get_friend_by_address(const LinphoneCore *lc, const char *addr);
|
||||
LinphoneFriend *linphone_core_get_friend_by_ref_key(const LinphoneCore *lc, const char *key);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LINPHONEFRIEND_H_ */
|
||||
|
|
@ -462,8 +462,13 @@ static int recvStunResponse(ortp_socket_t sock, char *ipaddr, int *port, int *id
|
|||
struct in_addr ia;
|
||||
stunParseMessage(buf,len, &resp );
|
||||
*id=resp.msgHdr.tr_id.octet[0];
|
||||
*port = resp.mappedAddress.ipv4.port;
|
||||
ia.s_addr=htonl(resp.mappedAddress.ipv4.addr);
|
||||
if (resp.hasXorMappedAddress){
|
||||
*port = resp.xorMappedAddress.ipv4.port;
|
||||
ia.s_addr=htonl(resp.xorMappedAddress.ipv4.addr);
|
||||
}else if (resp.hasMappedAddress){
|
||||
*port = resp.mappedAddress.ipv4.port;
|
||||
ia.s_addr=htonl(resp.mappedAddress.ipv4.addr);
|
||||
}else return -1;
|
||||
strncpy(ipaddr,inet_ntoa(ia),LINPHONE_IPADDR_SIZE);
|
||||
}
|
||||
return len;
|
||||
|
|
@ -754,14 +759,10 @@ static int get_local_ip_for_with_connect(int type, const char *dest, char *resul
|
|||
}
|
||||
|
||||
int linphone_core_get_local_ip_for(int type, const char *dest, char *result){
|
||||
if (dest==NULL) {
|
||||
if (type==AF_INET)
|
||||
dest="87.98.157.38"; /*a public IP address*/
|
||||
else dest="2a00:1450:8002::68";
|
||||
}
|
||||
strcpy(result,type==AF_INET ? "127.0.0.1" : "::1");
|
||||
#ifdef HAVE_GETIFADDRS
|
||||
{
|
||||
if (dest==NULL) {
|
||||
/*we use getifaddrs for lookup of default interface */
|
||||
int found_ifs;
|
||||
|
||||
found_ifs=get_local_ip_with_getifaddrs(type,result,LINPHONE_IPADDR_SIZE);
|
||||
|
|
@ -774,5 +775,33 @@ int linphone_core_get_local_ip_for(int type, const char *dest, char *result){
|
|||
}
|
||||
#endif
|
||||
/*else use connect to find the best local ip address */
|
||||
if (type==AF_INET)
|
||||
dest="87.98.157.38"; /*a public IP address*/
|
||||
else dest="2a00:1450:8002::68";
|
||||
return get_local_ip_for_with_connect(type,dest,result);
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
#include <resolv.h>
|
||||
|
||||
|
||||
|
||||
|
||||
void _linphone_core_configure_resolver(){
|
||||
/*bionic declares _res but does not define nor export it !!*/
|
||||
#ifdef ANDROID
|
||||
/*timeout and attempts are the same as retrans and retry, but are android specific names.*/
|
||||
setenv("RES_OPTIONS","timeout:1 attempts:2 retrans:1 retry:2",1);
|
||||
#else
|
||||
res_init();
|
||||
_res.retrans=1; /*retransmit every second*/
|
||||
_res.retry=2; /*only two times per DNS server*/
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void _linphone_core_configure_resolver(){
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ int offer_answer_initiate_outgoing(const SalMediaDescription *local_offer,
|
|||
for(i=0,j=0;i<local_offer->nstreams;++i){
|
||||
ms_message("Processing for stream %i",i);
|
||||
ls=&local_offer->streams[i];
|
||||
rs=sal_media_description_find_stream(remote_answer,ls->proto,ls->type);
|
||||
rs=sal_media_description_find_stream((SalMediaDescription*)remote_answer,ls->proto,ls->type);
|
||||
if (rs) {
|
||||
initiate_outgoing(ls,rs,&result->streams[j]);
|
||||
++j;
|
||||
|
|
@ -194,7 +194,7 @@ int offer_answer_initiate_incoming(const SalMediaDescription *local_capabilities
|
|||
for(i=0,j=0;i<remote_offer->nstreams;++i){
|
||||
rs=&remote_offer->streams[i];
|
||||
ms_message("Processing for stream %i",i);
|
||||
ls=sal_media_description_find_stream(local_capabilities,rs->proto,rs->type);
|
||||
ls=sal_media_description_find_stream((SalMediaDescription*)local_capabilities,rs->proto,rs->type);
|
||||
if (ls){
|
||||
initiate_incoming(ls,rs,&result->streams[j]);
|
||||
++j;
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ void linphone_core_add_subscriber(LinphoneCore *lc, const char *subscriber, SalO
|
|||
linphone_friend_set_inc_subscribe_policy(fl,LinphoneSPAccept);
|
||||
fl->inc_subscribe_pending=TRUE;
|
||||
lc->subscribers=ms_list_append(lc->subscribers,(void *)fl);
|
||||
if (lc->vtable.new_unknown_subscriber!=NULL) {
|
||||
if (lc->vtable.new_subscription_request!=NULL) {
|
||||
char *tmp=linphone_address_as_string(fl->uri);
|
||||
lc->vtable.new_unknown_subscriber(lc,fl,tmp);
|
||||
lc->vtable.new_subscription_request(lc,fl,tmp);
|
||||
ms_free(tmp);
|
||||
}
|
||||
}
|
||||
|
|
@ -57,11 +57,24 @@ void linphone_subscription_new(LinphoneCore *lc, SalOp *op, const char *from){
|
|||
LinphoneFriend *lf=NULL;
|
||||
char *tmp;
|
||||
LinphoneAddress *uri;
|
||||
LinphoneProxyConfig *cfg;
|
||||
const char *fixed_contact;
|
||||
|
||||
uri=linphone_address_new(from);
|
||||
linphone_address_clean(uri);
|
||||
tmp=linphone_address_as_string(uri);
|
||||
ms_message("Receiving new subscription from %s.",from);
|
||||
|
||||
cfg=linphone_core_lookup_known_proxy(lc,uri);
|
||||
if (cfg!=NULL){
|
||||
if (cfg->op){
|
||||
fixed_contact=sal_op_get_contact(cfg->op);
|
||||
if (fixed_contact) {
|
||||
sal_op_set_contact (op,fixed_contact);
|
||||
ms_message("Contact for next subscribe answer has been fixed using proxy to %s",fixed_contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* check if we answer to this subscription */
|
||||
if (linphone_find_friend(lc->friends,uri,&lf)!=NULL){
|
||||
lf->insub=op;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include "mediastreamer2/mediastream.h"
|
||||
|
||||
#ifndef LIBLINPHONE_VERSION
|
||||
#define LIBLINPHONE_VERSION LINPHONE_VERSION
|
||||
|
|
@ -54,6 +55,13 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
struct _LinphoneCallParams{
|
||||
LinphoneCall *referer; /*in case this call creation is consecutive to an incoming transfer, this points to the original call */
|
||||
bool_t has_video;
|
||||
bool_t pad[3];
|
||||
};
|
||||
|
||||
struct _LinphoneCall
|
||||
{
|
||||
struct _LinphoneCore *core;
|
||||
|
|
@ -69,6 +77,7 @@ struct _LinphoneCall
|
|||
time_t start_time; /*time at which the call was initiated*/
|
||||
time_t media_start_time; /*time at which it was accepted, media streams established*/
|
||||
LinphoneCallState state;
|
||||
LinphoneReason reason;
|
||||
int refcnt;
|
||||
void * user_pointer;
|
||||
int audio_port;
|
||||
|
|
@ -76,12 +85,15 @@ struct _LinphoneCall
|
|||
struct _AudioStream *audiostream; /**/
|
||||
struct _VideoStream *videostream;
|
||||
char *refer_to;
|
||||
LinphoneCallParams params;
|
||||
bool_t refer_pending;
|
||||
bool_t media_pending;
|
||||
bool_t audio_muted;
|
||||
bool_t camera_active;
|
||||
};
|
||||
|
||||
LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to);
|
||||
|
||||
LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params);
|
||||
LinphoneCall * linphone_call_new_incoming(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op);
|
||||
void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const char *message);
|
||||
|
||||
|
|
@ -156,6 +168,7 @@ void linphone_core_update_allocated_audio_bandwidth(LinphoneCore *lc);
|
|||
void linphone_core_update_allocated_audio_bandwidth_in_call(LinphoneCore *lc, const PayloadType *pt);
|
||||
void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call);
|
||||
|
||||
void linphone_core_send_initial_subscribes(LinphoneCore *lc);
|
||||
void linphone_core_write_friends_config(LinphoneCore* lc);
|
||||
void linphone_friend_write_to_config_file(struct _LpConfig *config, LinphoneFriend *lf, int index);
|
||||
LinphoneFriend * linphone_friend_new_from_config_file(struct _LinphoneCore *lc, int index);
|
||||
|
|
@ -163,6 +176,7 @@ LinphoneFriend * linphone_friend_new_from_config_file(struct _LinphoneCore *lc,
|
|||
void linphone_proxy_config_update(LinphoneProxyConfig *cfg);
|
||||
void linphone_proxy_config_get_contact(LinphoneProxyConfig *cfg, const char **ip, int *port);
|
||||
LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const LinphoneAddress *uri);
|
||||
const char *linphone_core_find_best_identity(LinphoneCore *lc, const LinphoneAddress *to, const char **route);
|
||||
int linphone_core_get_local_ip_for(int type, const char *dest, char *result);
|
||||
|
||||
LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(struct _LpConfig *config, int index);
|
||||
|
|
@ -174,20 +188,19 @@ void linphone_core_text_received(LinphoneCore *lc, const char *from, const char
|
|||
|
||||
void linphone_call_init_media_streams(LinphoneCall *call);
|
||||
void linphone_call_start_media_streams(LinphoneCall *call);
|
||||
void linphone_call_set_media_streams_dir(LinphoneCall *call, SalStreamDir dir);
|
||||
void linphone_call_start_early_media(LinphoneCall *call);
|
||||
void linphone_call_stop_media_streams(LinphoneCall *call);
|
||||
|
||||
const char * linphone_core_get_identity(LinphoneCore *lc);
|
||||
const char * linphone_core_get_route(LinphoneCore *lc);
|
||||
bool_t linphone_core_is_in_communication_with(LinphoneCore *lc, const char *to);
|
||||
void linphone_core_start_waiting(LinphoneCore *lc, const char *purpose);
|
||||
void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float progresses);
|
||||
void linphone_core_stop_waiting(LinphoneCore *lc);
|
||||
|
||||
int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy);
|
||||
void linphone_core_start_pending_refered_calls(LinphoneCore *lc);
|
||||
void linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *call);
|
||||
extern SalCallbacks linphone_sal_callbacks;
|
||||
|
||||
void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg, LinphoneReason error);
|
||||
|
||||
struct _LinphoneProxyConfig
|
||||
{
|
||||
|
|
@ -203,6 +216,8 @@ struct _LinphoneProxyConfig
|
|||
struct _SipSetupContext *ssctx;
|
||||
int auth_failures;
|
||||
char *dial_prefix;
|
||||
LinphoneRegistrationState state;
|
||||
SalOp *publish_op;
|
||||
bool_t commit;
|
||||
bool_t reg_sendregister;
|
||||
bool_t registered;
|
||||
|
|
@ -210,6 +225,7 @@ struct _LinphoneProxyConfig
|
|||
bool_t dial_escape_plus;
|
||||
void* user_data;
|
||||
time_t deletion_date;
|
||||
LinphoneReason error;
|
||||
};
|
||||
|
||||
struct _LinphoneAuthInfo
|
||||
|
|
@ -226,8 +242,8 @@ struct _LinphoneAuthInfo
|
|||
struct _LinphoneChatRoom{
|
||||
struct _LinphoneCore *lc;
|
||||
char *peer;
|
||||
char *route;
|
||||
LinphoneAddress *peer_url;
|
||||
SalOp *op;
|
||||
void * user_data;
|
||||
};
|
||||
|
||||
|
|
@ -243,6 +259,7 @@ struct _LinphoneFriend{
|
|||
bool_t subscribe;
|
||||
bool_t subscribe_active;
|
||||
bool_t inc_subscribe_pending;
|
||||
bool_t commit;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -309,6 +326,7 @@ typedef struct sound_config
|
|||
char source;
|
||||
char *local_ring;
|
||||
char *remote_ring;
|
||||
char *ringback_tone;
|
||||
bool_t ec;
|
||||
bool_t ea;
|
||||
bool_t agc;
|
||||
|
|
@ -328,6 +346,7 @@ typedef struct video_config{
|
|||
bool_t show_local;
|
||||
bool_t display;
|
||||
bool_t selfview; /*during calls*/
|
||||
const char *displaytype;
|
||||
}video_config_t;
|
||||
|
||||
typedef struct ui_config
|
||||
|
|
@ -354,6 +373,7 @@ struct _LinphoneCore
|
|||
{
|
||||
LinphoneCoreVTable vtable;
|
||||
Sal *sal;
|
||||
LinphoneGlobalState state;
|
||||
struct _LpConfig *config;
|
||||
net_config_t net_conf;
|
||||
sip_config_t sip_conf;
|
||||
|
|
@ -376,7 +396,7 @@ struct _LinphoneCore
|
|||
MSList *chatrooms;
|
||||
int max_call_logs;
|
||||
int missed_calls;
|
||||
struct _VideoStream *previewstream;
|
||||
VideoPreview *previewstream;
|
||||
struct _MSEventQueue *msevq;
|
||||
RtpTransport *a_rtp,*a_rtcp;
|
||||
MSList *bl_reqs;
|
||||
|
|
@ -395,13 +415,17 @@ struct _LinphoneCore
|
|||
int audio_bw;
|
||||
LinphoneWaitingCallback wait_cb;
|
||||
void *wait_ctx;
|
||||
unsigned long video_window_id;
|
||||
unsigned long preview_window_id;
|
||||
time_t netup_time; /*time when network went reachable */
|
||||
bool_t use_files;
|
||||
bool_t apply_nat_settings;
|
||||
bool_t ready;
|
||||
bool_t initial_subscribes_sent;
|
||||
bool_t bl_refresh;
|
||||
bool_t preview_finished;
|
||||
bool_t auto_net_state_mon;
|
||||
bool_t network_reachable;
|
||||
bool_t use_preview_window;
|
||||
};
|
||||
|
||||
bool_t linphone_core_can_we_add_call(LinphoneCore *lc);
|
||||
|
|
@ -412,6 +436,12 @@ int linphone_core_get_calls_nb(const LinphoneCore *lc);
|
|||
|
||||
void linphone_core_set_state(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message);
|
||||
|
||||
SalMediaDescription *create_local_media_description(LinphoneCore *lc,
|
||||
LinphoneCall *call, bool_t with_video, bool_t only_one_codec);
|
||||
|
||||
#define linphone_core_ready(lc) ((lc)->state!=LinphoneGlobalStartup)
|
||||
void _linphone_core_configure_resolver();
|
||||
|
||||
#define HOLD_OFF (0)
|
||||
#define HOLD_ON (1)
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ void linphone_proxy_config_destroy(LinphoneProxyConfig *obj){
|
|||
if (obj->type!=NULL) ms_free(obj->type);
|
||||
if (obj->dial_prefix!=NULL) ms_free(obj->dial_prefix);
|
||||
if (obj->op) sal_op_release(obj->op);
|
||||
if (obj->publish_op) sal_op_release(obj->publish_op);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -166,10 +167,16 @@ int linphone_proxy_config_set_route(LinphoneProxyConfig *obj, const char *route)
|
|||
obj->reg_route=NULL;
|
||||
}
|
||||
if (route!=NULL){
|
||||
LinphoneAddress *addr;
|
||||
/*try to prepend 'sip:' */
|
||||
if (strstr(route,"sip:")==NULL){
|
||||
obj->reg_route=ms_strdup_printf("sip:%s",route);
|
||||
}else obj->reg_route=ms_strdup(route);
|
||||
addr=linphone_address_new(obj->reg_route);
|
||||
if (addr==NULL){
|
||||
ms_free(obj->reg_route);
|
||||
obj->reg_route=NULL;
|
||||
}else linphone_address_destroy(addr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -433,7 +440,9 @@ int linphone_proxy_config_send_publish(LinphoneProxyConfig *proxy,
|
|||
SalOp *op=sal_op_new(proxy->lc->sal);
|
||||
err=sal_publish(op,linphone_proxy_config_get_identity(proxy),
|
||||
linphone_proxy_config_get_identity(proxy),linphone_online_status_to_sal(presence_mode));
|
||||
sal_op_release(op);
|
||||
if (proxy->publish_op!=NULL)
|
||||
sal_op_release(proxy->publish_op);
|
||||
proxy->publish_op=op;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -691,8 +700,11 @@ void linphone_proxy_config_update(LinphoneProxyConfig *cfg){
|
|||
if (cfg->type && cfg->ssctx==NULL){
|
||||
linphone_proxy_config_activate_sip_setup(cfg);
|
||||
}
|
||||
if (lc->sip_conf.register_only_when_network_is_up || lc->network_reachable)
|
||||
if (!lc->sip_conf.register_only_when_network_is_up || lc->network_reachable)
|
||||
linphone_proxy_config_register(cfg);
|
||||
if (cfg->publish && cfg->publish_op==NULL){
|
||||
linphone_proxy_config_send_publish(cfg,lc->presence_mode);
|
||||
}
|
||||
cfg->commit=FALSE;
|
||||
}
|
||||
}
|
||||
|
|
@ -799,10 +811,43 @@ void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr) {
|
|||
|
||||
void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const char *message){
|
||||
LinphoneCore *lc=cfg->lc;
|
||||
cfg->state=state;
|
||||
if (lc && lc->vtable.registration_state_changed){
|
||||
lc->vtable.registration_state_changed(lc,cfg,state,message);
|
||||
}
|
||||
}
|
||||
|
||||
LinphoneRegistrationState linphone_proxy_config_get_state(const LinphoneProxyConfig *cfg){
|
||||
return cfg->state;
|
||||
}
|
||||
|
||||
const char *linphone_registration_state_to_string(LinphoneRegistrationState cs){
|
||||
switch(cs){
|
||||
case LinphoneRegistrationCleared:
|
||||
return "LinphoneRegistrationCleared";
|
||||
break;
|
||||
case LinphoneRegistrationNone:
|
||||
return "LinphoneRegistrationNone";
|
||||
break;
|
||||
case LinphoneRegistrationProgress:
|
||||
return "LinphoneRegistrationProgress";
|
||||
break;
|
||||
case LinphoneRegistrationOk:
|
||||
return "LinphoneRegistrationOk";
|
||||
break;
|
||||
case LinphoneRegistrationFailed:
|
||||
return "LinphoneRegistrationFailed";
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LinphoneReason linphone_proxy_config_get_error(const LinphoneProxyConfig *cfg) {
|
||||
return cfg->error;
|
||||
}
|
||||
|
||||
void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg,LinphoneReason error) {
|
||||
cfg->error = error;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@ void sal_media_description_unref(SalMediaDescription *md){
|
|||
}
|
||||
}
|
||||
|
||||
const SalStreamDescription *sal_media_description_find_stream(const SalMediaDescription *md,
|
||||
SalStreamDescription *sal_media_description_find_stream(SalMediaDescription *md,
|
||||
SalMediaProto proto, SalStreamType type){
|
||||
int i;
|
||||
for(i=0;i<md->nstreams;++i){
|
||||
const SalStreamDescription *ss=&md->streams[i];
|
||||
SalStreamDescription *ss=&md->streams[i];
|
||||
if (ss->proto==proto && ss->type==type) return ss;
|
||||
}
|
||||
return NULL;
|
||||
|
|
@ -81,11 +81,17 @@ void sal_media_description_set_dir(SalMediaDescription *md, SalStreamDir stream_
|
|||
|
||||
bool_t sal_media_description_has_dir(const SalMediaDescription *md, SalStreamDir stream_dir){
|
||||
int i;
|
||||
bool_t found=FALSE;
|
||||
|
||||
/* we are looking for at least one stream with requested direction, inactive streams are ignored*/
|
||||
for(i=0;i<md->nstreams;++i){
|
||||
const SalStreamDescription *ss=&md->streams[i];
|
||||
if (ss->dir==stream_dir) return TRUE;
|
||||
if (ss->dir==stream_dir) found=TRUE;
|
||||
else{
|
||||
if (ss->dir!=SalStreamInactive) return FALSE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
return found;
|
||||
}
|
||||
|
||||
static void assign_string(char **str, const char *arg){
|
||||
|
|
@ -137,6 +143,10 @@ const char *sal_op_get_route(const SalOp *op){
|
|||
return ((SalOpBase*)op)->route;
|
||||
}
|
||||
|
||||
const char *sal_op_get_remote_ua(const SalOp *op){
|
||||
return ((SalOpBase*)op)->remote_ua;
|
||||
}
|
||||
|
||||
void *sal_op_get_user_pointer(const SalOp *op){
|
||||
return ((SalOpBase*)op)->user_pointer;
|
||||
}
|
||||
|
|
@ -181,6 +191,10 @@ void __sal_op_free(SalOp *op){
|
|||
ms_free(b->origin);
|
||||
b->origin=NULL;
|
||||
}
|
||||
if (b->remote_ua){
|
||||
ms_free(b->remote_ua);
|
||||
b->remote_ua=NULL;
|
||||
}
|
||||
if (b->local_media)
|
||||
sal_media_description_unref(b->local_media);
|
||||
if (b->remote_media)
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ void sal_media_description_ref(SalMediaDescription *md);
|
|||
void sal_media_description_unref(SalMediaDescription *md);
|
||||
bool_t sal_media_description_empty(const SalMediaDescription *md);
|
||||
bool_t sal_media_description_has_dir(const SalMediaDescription *md, SalStreamDir dir);
|
||||
const SalStreamDescription *sal_media_description_find_stream(const SalMediaDescription *md,
|
||||
SalStreamDescription *sal_media_description_find_stream(SalMediaDescription *md,
|
||||
SalMediaProto proto, SalStreamType type);
|
||||
void sal_media_description_set_dir(SalMediaDescription *md, SalStreamDir stream_dir);
|
||||
|
||||
|
|
@ -140,6 +140,7 @@ typedef struct SalOpBase{
|
|||
char *from;
|
||||
char *to;
|
||||
char *origin;
|
||||
char *remote_ua;
|
||||
SalMediaDescription *local_media;
|
||||
SalMediaDescription *remote_media;
|
||||
void *user_pointer;
|
||||
|
|
@ -267,19 +268,27 @@ const char *sal_op_get_route(const SalOp *op);
|
|||
const char *sal_op_get_proxy(const SalOp *op);
|
||||
/*for incoming requests, returns the origin of the packet as a sip uri*/
|
||||
const char *sal_op_get_network_origin(const SalOp *op);
|
||||
/*returns far-end "User-Agent" string */
|
||||
const char *sal_op_get_remote_ua(const SalOp *op);
|
||||
void *sal_op_get_user_pointer(const SalOp *op);
|
||||
|
||||
/*Call API*/
|
||||
int sal_call_set_local_media_description(SalOp *h, SalMediaDescription *desc);
|
||||
int sal_call(SalOp *h, const char *from, const char *to);
|
||||
int sal_call_notify_ringing(SalOp *h);
|
||||
int sal_call_notify_ringing(SalOp *h, bool_t early_media);
|
||||
/*accept an incoming call or, during a call accept a reINVITE*/
|
||||
int sal_call_accept(SalOp*h);
|
||||
int sal_call_decline(SalOp *h, SalReason reason, const char *redirection /*optional*/);
|
||||
int sal_call_hold(SalOp *h, bool_t holdon);
|
||||
int sal_call_update(SalOp *h);
|
||||
SalMediaDescription * sal_call_get_final_media_description(SalOp *h);
|
||||
int sal_refer(SalOp *h, const char *refer_to);
|
||||
int sal_refer_accept(SalOp *h);
|
||||
int sal_call_refer(SalOp *h, const char *refer_to);
|
||||
int sal_call_refer_with_replaces(SalOp *h, SalOp *other_call_h);
|
||||
int sal_call_accept_refer(SalOp *h);
|
||||
/*informs this call is consecutive to an incoming refer */
|
||||
int sal_call_set_referer(SalOp *h, SalOp *refered_call);
|
||||
/* returns the SalOp of a call that should be replaced by h, if any */
|
||||
SalOp *sal_call_get_replaces(SalOp *h);
|
||||
int sal_call_send_dtmf(SalOp *h, char dtmf);
|
||||
int sal_call_terminate(SalOp *h);
|
||||
bool_t sal_call_autoanswer_asked(SalOp *op);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
static void text_received(Sal *sal, eXosip_event_t *ev);
|
||||
|
||||
static void _osip_list_set_empty(osip_list_t *l, void (*freefunc)(void*)){
|
||||
void _osip_list_set_empty(osip_list_t *l, void (*freefunc)(void*)){
|
||||
void *data;
|
||||
while((data=osip_list_get(l,0))!=NULL){
|
||||
osip_list_remove(l,0);
|
||||
|
|
@ -102,7 +102,7 @@ static SalOp * sal_find_other(Sal *sal, osip_message_t *response){
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void sal_add_other(Sal *sal, SalOp *op, osip_message_t *request){
|
||||
void sal_add_other(Sal *sal, SalOp *op, osip_message_t *request){
|
||||
osip_call_id_t *callid=osip_message_get_call_id(request);
|
||||
if (callid==NULL) {
|
||||
ms_error("There is no call id in the request !");
|
||||
|
|
@ -161,6 +161,8 @@ SalOp * sal_op_new(Sal *sal){
|
|||
op->sdp_answer=NULL;
|
||||
op->reinvite=FALSE;
|
||||
op->call_id=NULL;
|
||||
op->replaces=NULL;
|
||||
op->referred_by=NULL;
|
||||
op->masquerade_via=FALSE;
|
||||
op->auto_answer_asked=FALSE;
|
||||
return op;
|
||||
|
|
@ -201,6 +203,12 @@ void sal_op_release(SalOp *op){
|
|||
sal_remove_other(op->base.root,op);
|
||||
osip_call_id_free(op->call_id);
|
||||
}
|
||||
if (op->replaces){
|
||||
ms_free(op->replaces);
|
||||
}
|
||||
if (op->referred_by){
|
||||
ms_free(op->referred_by);
|
||||
}
|
||||
__sal_op_free(op);
|
||||
}
|
||||
|
||||
|
|
@ -490,6 +498,12 @@ int sal_call(SalOp *h, const char *from, const char *to){
|
|||
h->sdp_offering=TRUE;
|
||||
set_sdp_from_desc(invite,h->base.local_media);
|
||||
}else h->sdp_offering=FALSE;
|
||||
if (h->replaces){
|
||||
osip_message_set_header(invite,"Replaces",h->replaces);
|
||||
if (h->referred_by)
|
||||
osip_message_set_header(invite,"Referred-By",h->referred_by);
|
||||
}
|
||||
|
||||
eXosip_lock();
|
||||
err=eXosip_call_send_initial_invite(invite);
|
||||
eXosip_unlock();
|
||||
|
|
@ -503,10 +517,31 @@ int sal_call(SalOp *h, const char *from, const char *to){
|
|||
return 0;
|
||||
}
|
||||
|
||||
int sal_call_notify_ringing(SalOp *h){
|
||||
eXosip_lock();
|
||||
eXosip_call_send_answer(h->tid,180,NULL);
|
||||
eXosip_unlock();
|
||||
int sal_call_notify_ringing(SalOp *h, bool_t early_media){
|
||||
osip_message_t *msg;
|
||||
int err;
|
||||
|
||||
/*if early media send also 180 and 183 */
|
||||
if (early_media && h->sdp_answer){
|
||||
msg=NULL;
|
||||
eXosip_lock();
|
||||
err=eXosip_call_build_answer(h->tid,180,&msg);
|
||||
if (msg){
|
||||
set_sdp(msg,h->sdp_answer);
|
||||
eXosip_call_send_answer(h->tid,180,msg);
|
||||
}
|
||||
msg=NULL;
|
||||
err=eXosip_call_build_answer(h->tid,183,&msg);
|
||||
if (msg){
|
||||
set_sdp(msg,h->sdp_answer);
|
||||
eXosip_call_send_answer(h->tid,183,msg);
|
||||
}
|
||||
eXosip_unlock();
|
||||
}else{
|
||||
eXosip_lock();
|
||||
eXosip_call_send_answer(h->tid,180,NULL);
|
||||
eXosip_unlock();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -585,6 +620,14 @@ SalMediaDescription * sal_call_get_final_media_description(SalOp *h){
|
|||
return h->result;
|
||||
}
|
||||
|
||||
int sal_call_set_referer(SalOp *h, SalOp *refered_call){
|
||||
if (refered_call->replaces)
|
||||
h->replaces=ms_strdup(refered_call->replaces);
|
||||
if (refered_call->referred_by)
|
||||
h->referred_by=ms_strdup(refered_call->referred_by);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sal_ping(SalOp *op, const char *from, const char *to){
|
||||
osip_message_t *options=NULL;
|
||||
|
||||
|
|
@ -603,7 +646,7 @@ int sal_ping(SalOp *op, const char *from, const char *to){
|
|||
return -1;
|
||||
}
|
||||
|
||||
int sal_refer_accept(SalOp *op){
|
||||
int sal_call_accept_refer(SalOp *op){
|
||||
osip_message_t *msg=NULL;
|
||||
int err=0;
|
||||
eXosip_lock();
|
||||
|
|
@ -623,7 +666,7 @@ int sal_refer_accept(SalOp *op){
|
|||
return err;
|
||||
}
|
||||
|
||||
int sal_refer(SalOp *h, const char *refer_to){
|
||||
int sal_call_refer(SalOp *h, const char *refer_to){
|
||||
osip_message_t *msg=NULL;
|
||||
int err=0;
|
||||
eXosip_lock();
|
||||
|
|
@ -634,6 +677,38 @@ int sal_refer(SalOp *h, const char *refer_to){
|
|||
return err;
|
||||
}
|
||||
|
||||
int sal_call_refer_with_replaces(SalOp *h, SalOp *other_call_h){
|
||||
osip_message_t *msg=NULL;
|
||||
char referto[256]={0};
|
||||
int err=0;
|
||||
eXosip_lock();
|
||||
if (eXosip_call_get_referto(other_call_h->did,referto,sizeof(referto)-1)!=0){
|
||||
ms_error("eXosip_call_get_referto() failed for did=%i",other_call_h->did);
|
||||
eXosip_unlock();
|
||||
return -1;
|
||||
}
|
||||
eXosip_call_build_refer(h->did,referto, &msg);
|
||||
osip_message_set_header(msg,"Referred-By",h->base.from);
|
||||
if (msg) err=eXosip_call_send_request(h->did, msg);
|
||||
else err=-1;
|
||||
eXosip_unlock();
|
||||
return err;
|
||||
}
|
||||
|
||||
SalOp *sal_call_get_replaces(SalOp *h){
|
||||
if (h->replaces!=NULL){
|
||||
int cid;
|
||||
eXosip_lock();
|
||||
cid=eXosip_call_find_by_replaces(h->replaces);
|
||||
eXosip_unlock();
|
||||
if (cid>0){
|
||||
SalOp *ret=sal_find_call(h->base.root,cid);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int sal_call_send_dtmf(SalOp *h, char dtmf){
|
||||
osip_message_t *msg=NULL;
|
||||
char dtmf_body[128];
|
||||
|
|
@ -701,6 +776,31 @@ static void set_network_origin(SalOp *op, osip_message_t *req){
|
|||
__sal_op_set_network_origin(op,origin);
|
||||
}
|
||||
|
||||
static void set_remote_ua(SalOp* op, osip_message_t *req){
|
||||
if (op->base.remote_ua==NULL){
|
||||
osip_header_t *h=NULL;
|
||||
osip_message_get_user_agent(req,0,&h);
|
||||
if (h){
|
||||
op->base.remote_ua=ms_strdup(h->hvalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void set_replaces(SalOp *op, osip_message_t *req){
|
||||
osip_header_t *h=NULL;
|
||||
|
||||
if (op->replaces){
|
||||
ms_free(op->replaces);
|
||||
op->replaces=NULL;
|
||||
}
|
||||
osip_message_header_get_byname(req,"replaces",0,&h);
|
||||
if (h){
|
||||
if (h->hvalue && h->hvalue[0]!='\0'){
|
||||
op->replaces=ms_strdup(h->hvalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static SalOp *find_op(Sal *sal, eXosip_event_t *ev){
|
||||
if (ev->cid>0){
|
||||
return sal_find_call(sal,ev->cid);
|
||||
|
|
@ -708,6 +808,9 @@ static SalOp *find_op(Sal *sal, eXosip_event_t *ev){
|
|||
if (ev->rid>0){
|
||||
return sal_find_register(sal,ev->rid);
|
||||
}
|
||||
if (ev->sid>0){
|
||||
return sal_find_out_subscribe(sal,ev->sid);
|
||||
}
|
||||
if (ev->response) return sal_find_other(sal,ev->response);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -720,6 +823,8 @@ static void inc_new_call(Sal *sal, eXosip_event_t *ev){
|
|||
sdp_message_t *sdp=eXosip_get_sdp_info(ev->request);
|
||||
|
||||
set_network_origin(op,ev->request);
|
||||
set_remote_ua(op,ev->request);
|
||||
set_replaces(op,ev->request);
|
||||
|
||||
if (sdp){
|
||||
op->sdp_offering=FALSE;
|
||||
|
|
@ -836,6 +941,7 @@ static void update_contact_from_response(SalOp *op, osip_message_t *response){
|
|||
tmp=sal_address_as_string(addr);
|
||||
ms_message("Contact address updated to %s for this dialog",tmp);
|
||||
sal_op_set_contact(op,tmp);
|
||||
sal_address_destroy(addr);
|
||||
ms_free(tmp);
|
||||
}
|
||||
}
|
||||
|
|
@ -865,7 +971,8 @@ static void call_ringing(Sal *sal, eXosip_event_t *ev){
|
|||
sdp_message_t *sdp;
|
||||
SalOp *op=find_op(sal,ev);
|
||||
if (call_proceeding(sal, ev)==-1) return;
|
||||
|
||||
|
||||
set_remote_ua(op,ev->response);
|
||||
sdp=eXosip_get_sdp_info(ev->response);
|
||||
if (sdp){
|
||||
op->base.remote_media=sal_media_description_new();
|
||||
|
|
@ -888,7 +995,8 @@ static void call_accepted(Sal *sal, eXosip_event_t *ev){
|
|||
}
|
||||
|
||||
op->did=ev->did;
|
||||
|
||||
set_remote_ua(op,ev->response);
|
||||
|
||||
sdp=eXosip_get_sdp_info(ev->response);
|
||||
if (sdp){
|
||||
op->base.remote_media=sal_media_description_new();
|
||||
|
|
@ -1124,8 +1232,18 @@ static void process_media_control_xml(Sal *sal, eXosip_event_t *ev){
|
|||
eXosip_call_build_answer(ev->tid,200,&ans);
|
||||
if (ans)
|
||||
eXosip_call_send_answer(ev->tid,200,ans);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*in all other cases we must say it is not implemented.*/
|
||||
{
|
||||
osip_message_t *ans=NULL;
|
||||
eXosip_lock();
|
||||
eXosip_call_build_answer(ev->tid,501,&ans);
|
||||
if (ans)
|
||||
eXosip_call_send_answer(ev->tid,501,ans);
|
||||
eXosip_unlock();
|
||||
}
|
||||
}
|
||||
|
||||
static void process_dtmf_relay(Sal *sal, eXosip_event_t *ev){
|
||||
|
|
@ -1159,6 +1277,59 @@ static void process_dtmf_relay(Sal *sal, eXosip_event_t *ev){
|
|||
}
|
||||
}
|
||||
|
||||
static void fill_options_answer(osip_message_t *options){
|
||||
osip_message_set_allow(options,"INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, SUBSCRIBE, NOTIFY, INFO");
|
||||
osip_message_set_accept(options,"application/sdp");
|
||||
}
|
||||
|
||||
static void process_refer(Sal *sal, SalOp *op, eXosip_event_t *ev){
|
||||
osip_header_t *h=NULL;
|
||||
osip_message_t *ans=NULL;
|
||||
ms_message("Receiving REFER request !");
|
||||
osip_message_header_get_byname(ev->request,"Refer-To",0,&h);
|
||||
|
||||
if (h){
|
||||
osip_from_t *from=NULL;
|
||||
char *tmp;
|
||||
osip_from_init(&from);
|
||||
|
||||
if (osip_from_parse(from,h->hvalue)==0){
|
||||
if (op ){
|
||||
osip_uri_header_t *uh=NULL;
|
||||
osip_header_t *referred_by=NULL;
|
||||
osip_uri_header_get_byname(&from->url->url_headers,(char*)"Replaces",&uh);
|
||||
if (uh!=NULL && uh->gvalue && uh->gvalue[0]!='\0'){
|
||||
ms_message("Found replaces in Refer-To");
|
||||
if (op->replaces){
|
||||
ms_free(op->replaces);
|
||||
}
|
||||
op->replaces=ms_strdup(uh->gvalue);
|
||||
}
|
||||
osip_message_header_get_byname(ev->request,"Referred-By",0,&referred_by);
|
||||
if (referred_by && referred_by->hvalue && referred_by->hvalue[0]!='\0'){
|
||||
if (op->referred_by)
|
||||
ms_free(op->referred_by);
|
||||
op->referred_by=ms_strdup(referred_by->hvalue);
|
||||
}
|
||||
}
|
||||
osip_uri_header_freelist(&from->url->url_headers);
|
||||
osip_from_to_str(from,&tmp);
|
||||
sal->callbacks.refer_received(sal,op,tmp);
|
||||
osip_free(tmp);
|
||||
osip_from_free(from);
|
||||
}
|
||||
eXosip_lock();
|
||||
eXosip_call_build_answer(ev->tid,202,&ans);
|
||||
if (ans)
|
||||
eXosip_call_send_answer(ev->tid,202,ans);
|
||||
eXosip_unlock();
|
||||
}
|
||||
else
|
||||
{
|
||||
ms_warning("cannot do anything with the refer without destination\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void call_message_new(Sal *sal, eXosip_event_t *ev){
|
||||
osip_message_t *ans=NULL;
|
||||
if (ev->request){
|
||||
|
|
@ -1187,8 +1358,7 @@ static void call_message_new(Sal *sal, eXosip_event_t *ev){
|
|||
eXosip_call_send_answer(ev->tid,200,ans);
|
||||
eXosip_unlock();
|
||||
}
|
||||
}
|
||||
if(MSG_IS_MESSAGE(ev->request)){
|
||||
}else if(MSG_IS_MESSAGE(ev->request)){
|
||||
/* SIP messages could be received into call */
|
||||
text_received(sal, ev);
|
||||
eXosip_lock();
|
||||
|
|
@ -1196,27 +1366,12 @@ static void call_message_new(Sal *sal, eXosip_event_t *ev){
|
|||
if (ans)
|
||||
eXosip_call_send_answer(ev->tid,200,ans);
|
||||
eXosip_unlock();
|
||||
}
|
||||
if(MSG_IS_REFER(ev->request)){
|
||||
osip_header_t *h=NULL;
|
||||
}else if(MSG_IS_REFER(ev->request)){
|
||||
SalOp *op=find_op(sal,ev);
|
||||
|
||||
ms_message("Receiving REFER request !");
|
||||
osip_message_header_get_byname(ev->request,"Refer-To",0,&h);
|
||||
eXosip_lock();
|
||||
eXosip_call_build_answer(ev->tid,202,&ans);
|
||||
if (ans)
|
||||
eXosip_call_send_answer(ev->tid,202,ans);
|
||||
eXosip_unlock();
|
||||
if (h){
|
||||
sal->callbacks.refer_received(sal,op,h->hvalue);
|
||||
}
|
||||
else
|
||||
{
|
||||
ms_warning("cannot do anything with the refer without destination\n");
|
||||
}
|
||||
}
|
||||
if(MSG_IS_NOTIFY(ev->request)){
|
||||
process_refer(sal,op,ev);
|
||||
}else if(MSG_IS_NOTIFY(ev->request)){
|
||||
osip_header_t *h=NULL;
|
||||
char *from=NULL;
|
||||
SalOp *op=find_op(sal,ev);
|
||||
|
|
@ -1233,6 +1388,14 @@ static void call_message_new(Sal *sal, eXosip_event_t *ev){
|
|||
eXosip_call_send_answer(ev->tid,200,ans);
|
||||
eXosip_unlock();
|
||||
osip_free(from);
|
||||
}else if (MSG_IS_OPTIONS(ev->request)){
|
||||
eXosip_lock();
|
||||
eXosip_call_build_answer(ev->tid,200,&ans);
|
||||
if (ans){
|
||||
fill_options_answer(ans);
|
||||
eXosip_call_send_answer(ev->tid,200,ans);
|
||||
}
|
||||
eXosip_unlock();
|
||||
}
|
||||
}else ms_warning("call_message_new: No request ?");
|
||||
}
|
||||
|
|
@ -1281,6 +1444,8 @@ static void text_received(Sal *sal, eXosip_event_t *ev){
|
|||
osip_free(from);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void other_request(Sal *sal, eXosip_event_t *ev){
|
||||
ms_message("in other_request");
|
||||
if (ev->request==NULL) return;
|
||||
|
|
@ -1290,8 +1455,7 @@ static void other_request(Sal *sal, eXosip_event_t *ev){
|
|||
}else if (strcmp(ev->request->sip_method,"OPTIONS")==0){
|
||||
osip_message_t *options=NULL;
|
||||
eXosip_options_build_answer(ev->tid,200,&options);
|
||||
osip_message_set_allow(options,"INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, SUBSCRIBE, NOTIFY, INFO");
|
||||
osip_message_set_accept(options,"application/sdp");
|
||||
fill_options_answer(options);
|
||||
eXosip_options_send_answer(ev->tid,200,options);
|
||||
}else if (strcmp(ev->request->sip_method,"WAKEUP")==0
|
||||
&& comes_from_local_if(ev->request)) {
|
||||
|
|
@ -1301,12 +1465,7 @@ static void other_request(Sal *sal, eXosip_event_t *ev){
|
|||
}else if (strncmp(ev->request->sip_method, "REFER", 5) == 0){
|
||||
ms_message("Receiving REFER request !");
|
||||
if (comes_from_local_if(ev->request)) {
|
||||
osip_header_t *h=NULL;
|
||||
osip_message_header_get_byname(ev->request,"Refer-To",0,&h);
|
||||
eXosip_message_send_answer(ev->tid,200,NULL);
|
||||
if (h){
|
||||
sal->callbacks.refer_received(sal,NULL,h->hvalue);
|
||||
}
|
||||
process_refer(sal,NULL,ev);
|
||||
}else ms_warning("Ignored REFER not coming from this local loopback interface.");
|
||||
}else if (strncmp(ev->request->sip_method, "UPDATE", 6) == 0){
|
||||
inc_update(sal,ev);
|
||||
|
|
@ -1402,7 +1561,9 @@ static void registration_success(Sal *sal, eXosip_event_t *ev){
|
|||
if (!register_again_with_updated_contact(op,ev->request,ev->response)){
|
||||
sal->callbacks.register_success(op,registered);
|
||||
}
|
||||
}else registered=FALSE;
|
||||
}else {
|
||||
sal->callbacks.register_success(op,FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static bool_t registration_failure(Sal *sal, eXosip_event_t *ev){
|
||||
|
|
@ -1571,8 +1732,16 @@ static bool_t process_event(Sal *sal, eXosip_event_t *ev){
|
|||
other_request_reply(sal,ev);
|
||||
break;
|
||||
case EXOSIP_MESSAGE_REQUESTFAILURE:
|
||||
if (ev->response && (ev->response->status_code == 407 || ev->response->status_code == 401)){
|
||||
return process_authentication(sal,ev);
|
||||
if (ev->response) {
|
||||
switch (ev->response->status_code) {
|
||||
case 407:
|
||||
case 401:
|
||||
return process_authentication(sal,ev);
|
||||
case 412: {
|
||||
eXosip_automatic_action ();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
other_request_reply(sal,ev);
|
||||
break;
|
||||
|
|
@ -1761,10 +1930,12 @@ void sal_set_keepalive_period(Sal *ctx,unsigned int value) {
|
|||
ctx->keepalive_period=value;
|
||||
eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE, &value);
|
||||
}
|
||||
|
||||
const char * sal_address_get_port(const SalAddress *addr) {
|
||||
const osip_from_t *u=(const osip_from_t*)addr;
|
||||
return null_if_empty(u->url->port);
|
||||
}
|
||||
|
||||
int sal_address_get_port_int(const SalAddress *uri) {
|
||||
const char* port = sal_address_get_port(uri);
|
||||
if (port != NULL) {
|
||||
|
|
@ -1803,3 +1974,29 @@ int sal_call_hold(SalOp *h, bool_t holdon)
|
|||
return err;
|
||||
}
|
||||
|
||||
/* sends a reinvite. Local media description may have changed by application since call establishment*/
|
||||
int sal_call_update(SalOp *h){
|
||||
int err=0;
|
||||
osip_message_t *reinvite=NULL;
|
||||
|
||||
eXosip_lock();
|
||||
if(eXosip_call_build_request(h->did,"INVITE",&reinvite) != OSIP_SUCCESS || reinvite==NULL){
|
||||
eXosip_unlock();
|
||||
return -1;
|
||||
}
|
||||
eXosip_unlock();
|
||||
osip_message_set_subject(reinvite,osip_strdup("Phone call parameters updated"));
|
||||
osip_message_set_allow(reinvite, "INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO");
|
||||
if (h->base.root->session_expires!=0){
|
||||
osip_message_set_header(reinvite, "Session-expires", "200");
|
||||
osip_message_set_supported(reinvite, "timer");
|
||||
}
|
||||
if (h->base.local_media){
|
||||
h->sdp_offering=TRUE;
|
||||
set_sdp_from_desc(reinvite,h->base.local_media);
|
||||
}else h->sdp_offering=FALSE;
|
||||
eXosip_lock();
|
||||
err = eXosip_call_send_request(h->did, reinvite);
|
||||
eXosip_unlock();
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ struct SalOp{
|
|||
eXosip_event_t *pending_auth;
|
||||
osip_call_id_t *call_id; /*used for out of calls transaction in order
|
||||
to retrieve the operation when receiving a response*/
|
||||
char *replaces;
|
||||
char *referred_by;
|
||||
bool_t supports_session_timers;
|
||||
bool_t sdp_offering;
|
||||
bool_t reinvite;
|
||||
|
|
@ -65,6 +67,7 @@ struct SalOp{
|
|||
|
||||
void sal_remove_out_subscribe(Sal *sal, SalOp *op);
|
||||
void sal_remove_in_subscribe(Sal *sal, SalOp *op);
|
||||
void sal_add_other(Sal *sal, SalOp *op, osip_message_t *request);
|
||||
|
||||
void sal_exosip_subscription_recv(Sal *sal, eXosip_event_t *ev);
|
||||
void sal_exosip_subscription_answered(Sal *sal,eXosip_event_t *ev);
|
||||
|
|
@ -72,8 +75,9 @@ void sal_exosip_notify_recv(Sal *sal,eXosip_event_t *ev);
|
|||
void sal_exosip_subscription_closed(Sal *sal,eXosip_event_t *ev);
|
||||
|
||||
void sal_exosip_in_subscription_closed(Sal *sal, eXosip_event_t *ev);
|
||||
|
||||
SalOp * sal_find_out_subscribe(Sal *sal, int sid);
|
||||
void sal_exosip_fix_route(SalOp *op);
|
||||
|
||||
void _osip_list_set_empty(osip_list_t *l, void (*freefunc)(void*));
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,8 +20,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "sal_eXosip2.h"
|
||||
|
||||
typedef enum {
|
||||
PIDF = 0,
|
||||
RFCxxxx = 1,
|
||||
MSOLDPRES = 2
|
||||
} presence_type_t;
|
||||
|
||||
static SalOp * sal_find_out_subscribe(Sal *sal, int sid){
|
||||
/*
|
||||
* REVISIT: this static variable forces every dialog to use the same presence description type depending
|
||||
* on what is received on a single dialog...
|
||||
*/
|
||||
static presence_type_t presence_style = PIDF;
|
||||
|
||||
SalOp * sal_find_out_subscribe(Sal *sal, int sid){
|
||||
const MSList *elem;
|
||||
SalOp *op;
|
||||
for(elem=sal->out_subscribes;elem!=NULL;elem=elem->next){
|
||||
|
|
@ -83,9 +94,14 @@ int sal_text_send(SalOp *op, const char *from, const char *to, const char *msg){
|
|||
eXosip_lock();
|
||||
eXosip_message_build_request(&sip,"MESSAGE",sal_op_get_to(op),
|
||||
sal_op_get_from(op),sal_op_get_route(op));
|
||||
osip_message_set_content_type(sip,"text/plain");
|
||||
osip_message_set_body(sip,msg,strlen(msg));
|
||||
eXosip_message_send_request(sip);
|
||||
if (sip!=NULL){
|
||||
osip_message_set_content_type(sip,"text/plain");
|
||||
osip_message_set_body(sip,msg,strlen(msg));
|
||||
sal_add_other(op->base.root,op,sip);
|
||||
eXosip_message_send_request(sip);
|
||||
}else{
|
||||
ms_error("Could not build MESSAGE request !");
|
||||
}
|
||||
eXosip_unlock();
|
||||
}
|
||||
else
|
||||
|
|
@ -93,22 +109,16 @@ int sal_text_send(SalOp *op, const char *from, const char *to, const char *msg){
|
|||
/* we are currently in communication with the destination */
|
||||
eXosip_lock();
|
||||
//First we generate an INFO message to get the current call_id and a good cseq
|
||||
eXosip_call_build_info(op->did,&sip);
|
||||
eXosip_call_build_request(op->did,"MESSAGE",&sip);
|
||||
if(sip == NULL)
|
||||
{
|
||||
ms_warning("could not get a build info to send MESSAGE, maybe no previous call established ?");
|
||||
osip_message_free(sip);
|
||||
eXosip_unlock();
|
||||
return -1;
|
||||
}
|
||||
//change the sip_message to be a MESSAGE ...
|
||||
osip_free(osip_message_get_method(sip));
|
||||
osip_message_set_method(sip,osip_strdup("MESSAGE"));
|
||||
osip_free(osip_cseq_get_method(osip_message_get_cseq(sip)));
|
||||
osip_cseq_set_method(osip_message_get_cseq(sip),osip_strdup("MESSAGE"));
|
||||
osip_message_set_content_type(sip,"text/plain");
|
||||
osip_message_set_body(sip,msg,strlen(msg));
|
||||
eXosip_message_send_request(sip);
|
||||
eXosip_call_send_request(op->did,sip);
|
||||
eXosip_unlock();
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -125,6 +135,10 @@ int sal_subscribe_presence(SalOp *op, const char *from, const char *to){
|
|||
eXosip_lock();
|
||||
eXosip_subscribe_build_initial_request(&msg,sal_op_get_to(op),sal_op_get_from(op),
|
||||
sal_op_get_route(op),"presence",600);
|
||||
if (op->base.contact){
|
||||
_osip_list_set_empty(&msg->contacts,(void (*)(void*))osip_contact_free);
|
||||
osip_message_set_contact(msg,op->base.contact);
|
||||
}
|
||||
op->sid=eXosip_subscribe_send_initial_request(msg);
|
||||
eXosip_unlock();
|
||||
if (op->sid==-1){
|
||||
|
|
@ -156,6 +170,10 @@ int sal_subscribe_accept(SalOp *op){
|
|||
osip_message_t *msg;
|
||||
eXosip_lock();
|
||||
eXosip_insubscription_build_answer(op->tid,202,&msg);
|
||||
if (op->base.contact){
|
||||
_osip_list_set_empty(&msg->contacts,(void (*)(void*))osip_contact_free);
|
||||
osip_message_set_contact(msg,op->base.contact);
|
||||
}
|
||||
eXosip_insubscription_send_answer(op->tid,202,msg);
|
||||
eXosip_unlock();
|
||||
return 0;
|
||||
|
|
@ -168,268 +186,372 @@ int sal_subscribe_decline(SalOp *op){
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void add_presence_body(osip_message_t *notify, SalPresenceStatus online_status)
|
||||
{
|
||||
char buf[1000];
|
||||
#ifdef SUPPORT_MSN
|
||||
int atom_id = 1000;
|
||||
#endif
|
||||
char *contact_info;
|
||||
static void mk_presence_body (const SalPresenceStatus online_status, const char *contact_info,
|
||||
char *buf, size_t buflen, presence_type_t ptype) {
|
||||
switch (ptype) {
|
||||
case RFCxxxx: {
|
||||
/* definition from http://msdn.microsoft.com/en-us/library/cc246202%28PROT.10%29.aspx */
|
||||
int atom_id = 1000;
|
||||
|
||||
osip_from_t *from=NULL;
|
||||
from=osip_message_get_from(notify);
|
||||
osip_uri_to_str(from->url,&contact_info);
|
||||
|
||||
#ifdef SUPPORT_MSN
|
||||
|
||||
if (online_status==SalPresenceOnline)
|
||||
{
|
||||
sprintf(buf, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence\n\
|
||||
PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
if (online_status==SalPresenceOnline)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s;user=ip\" priority=\"0.800000\">\n\
|
||||
<address uri=\"%s\" priority=\"0.800000\">\n\
|
||||
<status status=\"open\" />\n\
|
||||
<msnsubstatus substatus=\"online\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status==SalPresenceBusy)
|
||||
{
|
||||
sprintf(buf, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence\n\
|
||||
PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
}
|
||||
else if (online_status == SalPresenceBusy ||
|
||||
online_status == SalPresenceDonotdisturb)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s;user=ip\" priority=\"0.800000\">\n\
|
||||
<address uri=\"%s\" priority=\"0.800000\">\n\
|
||||
<status status=\"inuse\" />\n\
|
||||
<msnsubstatus substatus=\"busy\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
</atom>\n</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status==SalPresenceBerightback)
|
||||
{
|
||||
sprintf(buf, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence\n\
|
||||
PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
}
|
||||
else if (online_status==SalPresenceBerightback)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s;user=ip\" priority=\"0.800000\">\n\
|
||||
<status status=\"inactive\" />\n\
|
||||
<address uri=\"%s\" priority=\"0.800000\">\n\
|
||||
<status status=\"open\" />\n\
|
||||
<msnsubstatus substatus=\"berightback\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status==SalPresenceAway)
|
||||
{
|
||||
sprintf(buf, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence\n\
|
||||
PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
}
|
||||
else if (online_status == SalPresenceAway ||
|
||||
online_status == SalPresenceMoved)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s;user=ip\" priority=\"0.800000\">\n\
|
||||
<status status=\"inactive\" />\n\
|
||||
<address uri=\"%s\" priority=\"0.800000\">\n\
|
||||
<status status=\"open\" />\n\
|
||||
<msnsubstatus substatus=\"away\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status==SalPresenceOnthephone)
|
||||
{
|
||||
sprintf(buf, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence\n\
|
||||
PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
}
|
||||
else if (online_status==SalPresenceOnthephone)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s;user=ip\" priority=\"0.800000\">\n\
|
||||
<address uri=\"%s\" priority=\"0.800000\">\n\
|
||||
<status status=\"inuse\" />\n\
|
||||
<msnsubstatus substatus=\"onthephone\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status==SalPresenceOuttolunch)
|
||||
{
|
||||
sprintf(buf, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence\n\
|
||||
PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
}
|
||||
else if (online_status==SalPresenceOuttolunch)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s;user=ip\" priority=\"0.800000\">\n\
|
||||
<address uri=\"%s\" priority=\"0.800000\">\n\
|
||||
<status status=\"open\" />\n\
|
||||
<msnsubstatus substatus=\"outtolunch\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\" priority=\"0.800000\">\n\
|
||||
<status status=\"closed\" />\n\
|
||||
<msnsubstatus substatus=\"away\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MSOLDPRES: {
|
||||
/* Couldn't find schema http://schemas.microsoft.com/2002/09/sip/presence
|
||||
* so messages format has been taken from Communigate that can send notify
|
||||
* requests with this schema
|
||||
*/
|
||||
int atom_id = 1000;
|
||||
|
||||
if (online_status==SalPresenceOnline)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\">\n\
|
||||
<status status=\"open\" />\n\
|
||||
<msnsubstatus substatus=\"online\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status == SalPresenceBusy ||
|
||||
online_status == SalPresenceDonotdisturb)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\">\n\
|
||||
<status status=\"inuse\" />\n\
|
||||
<msnsubstatus substatus=\"busy\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status==SalPresenceBerightback)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\">\n\
|
||||
<status status=\"inactive\" />\n\
|
||||
<msnsubstatus substatus=\"berightback\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status == SalPresenceAway ||
|
||||
online_status == SalPresenceMoved)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\">\n\
|
||||
<status status=\"inactive\" />\n\
|
||||
<msnsubstatus substatus=\"idle\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status==SalPresenceOnthephone)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\">\n\
|
||||
<status status=\"inuse\" />\n\
|
||||
<msnsubstatus substatus=\"onthephone\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status==SalPresenceOuttolunch)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\">\n\
|
||||
<status status=\"inactive\" />\n\
|
||||
<msnsubstatus substatus=\"outtolunch\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(buf, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence\n\
|
||||
PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s;user=ip\" priority=\"0.800000\">\n\
|
||||
<status status=\"inactive\" />\n\
|
||||
<msnsubstatus substatus=\"away\" />\n\
|
||||
<address uri=\"%s\">\n\
|
||||
<status status=\"closed\" />\n\
|
||||
<msnsubstatus substatus=\"offline\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: { /* use pidf+xml as default format, rfc4479, rfc4480, rfc3863 */
|
||||
|
||||
osip_message_set_body(notify, buf, strlen(buf));
|
||||
osip_message_set_content_type(notify, "application/xpidf+xml");
|
||||
#else
|
||||
if (online_status==SalPresenceOnline)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" \
|
||||
xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" \
|
||||
xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" \
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status><basic>open</basic></status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
</tuple>\n\
|
||||
</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else if (online_status == SalPresenceBusy ||
|
||||
online_status == SalPresenceDonotdisturb)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" \
|
||||
xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" \
|
||||
xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" \
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status><basic>open</basic></status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
</tuple>\n\
|
||||
<dm:person id=\"sg89aep\">\n\
|
||||
<rpid:activities><rpid:busy/></rpid:activities>\n\
|
||||
</dm:person>\n\
|
||||
</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else if (online_status==SalPresenceBerightback)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" \
|
||||
xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" \
|
||||
xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" \
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status><basic>open</basic></status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
</tuple>\n\
|
||||
<dm:person id=\"sg89aep\">\n\
|
||||
<rpid:activities><rpid:in-transit/></rpid:activities>\n\
|
||||
</dm:person>\n\
|
||||
</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else if (online_status == SalPresenceAway ||
|
||||
online_status == SalPresenceMoved)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" \
|
||||
xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" \
|
||||
xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" \
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status><basic>open</basic></status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
</tuple>\n\
|
||||
<dm:person id=\"sg89aep\">\n\
|
||||
<rpid:activities><rpid:away/></rpid:activities>\n\
|
||||
</dm:person>\n\
|
||||
</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else if (online_status==SalPresenceOnthephone)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" \
|
||||
xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" \
|
||||
xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" \
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status><basic>open</basic></status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
</tuple>\n\
|
||||
<dm:person id=\"sg89aep\">\n\
|
||||
<rpid:activities><rpid:on-the-phone/></rpid:activities>\n\
|
||||
</dm:person>\n\
|
||||
</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else if (online_status==SalPresenceOuttolunch)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" \
|
||||
xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" \
|
||||
xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" \
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"7777\">\n\
|
||||
<status><basic>open</basic></status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
</tuple>\n\
|
||||
<dm:person id=\"78787878\">\n\
|
||||
<rpid:activities><rpid:meal/></rpid:activities>\n\
|
||||
<rpid:note>Out to lunch</rpid:note> \n\
|
||||
</dm:person>\n\
|
||||
</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" \
|
||||
xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" \
|
||||
xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" \
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status><basic>closed</basic></status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
</tuple>\n\
|
||||
</presence>\n", contact_info, contact_info);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} // switch
|
||||
|
||||
if (online_status==SalPresenceOnline)
|
||||
{
|
||||
sprintf(buf, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n\
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status>\n\
|
||||
<basic>open</basic>\n\
|
||||
</status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
<note>online</note>\n\
|
||||
</tuple>\n\
|
||||
</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else if (online_status==SalPresenceBusy)
|
||||
{
|
||||
sprintf(buf, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n\
|
||||
xmlns:es=\"urn:ietf:params:xml:ns:pidf:status:rpid-status\"\n\
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status>\n\
|
||||
<basic>open</basic>\n\
|
||||
<es:activities>\n\
|
||||
<es:activity>busy</es:activity>\n\
|
||||
</es:activities>\n\
|
||||
</status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
<note>busy</note>\n\
|
||||
</tuple>\n\
|
||||
</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else if (online_status==SalPresenceBerightback)
|
||||
{
|
||||
sprintf(buf, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n\
|
||||
xmlns:es=\"urn:ietf:params:xml:ns:pidf:status:rpid-status\"\n\
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status>\n\
|
||||
<basic>open</basic>\n\
|
||||
<es:activities>\n\
|
||||
<es:activity>in-transit</es:activity>\n\
|
||||
</es:activities>\n\
|
||||
</status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
<note>be right back</note>\n\
|
||||
</tuple>\n\
|
||||
</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else if (online_status==SalPresenceAway)
|
||||
{
|
||||
sprintf(buf, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n\
|
||||
xmlns:es=\"urn:ietf:params:xml:ns:pidf:status:rpid-status\"\n\
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status>\n\
|
||||
<basic>open</basic>\n\
|
||||
<es:activities>\n\
|
||||
<es:activity>away</es:activity>\n\
|
||||
</es:activities>\n\
|
||||
</status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
<note>away</note>\n\
|
||||
</tuple>\n\
|
||||
</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else if (online_status==SalPresenceOnthephone)
|
||||
{
|
||||
sprintf(buf, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n\
|
||||
xmlns:es=\"urn:ietf:params:xml:ns:pidf:status:rpid-status\"\n\
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status>\n\
|
||||
<basic>open</basic>\n\
|
||||
<es:activities>\n\
|
||||
<es:activity>on-the-phone</es:activity>\n\
|
||||
</es:activities>\n\
|
||||
</status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
<note>on the phone</note>\n\
|
||||
</tuple>\n\
|
||||
</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else if (online_status==SalPresenceOuttolunch)
|
||||
{
|
||||
sprintf(buf, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n\
|
||||
xmlns:es=\"urn:ietf:params:xml:ns:pidf:status:rpid-status\"\n\
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status>\n\
|
||||
<basic>open</basic>\n\
|
||||
<es:activities>\n\
|
||||
<es:activity>meal</es:activity>\n\
|
||||
</es:activities>\n\
|
||||
</status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
<note>out to lunch</note>\n\
|
||||
</tuple>\n\
|
||||
</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* */
|
||||
sprintf(buf, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n\
|
||||
xmlns:es=\"urn:ietf:params:xml:ns:pidf:status:rpid-status\"\n\
|
||||
entity=\"%s\">\n%s",
|
||||
contact_info,
|
||||
"<tuple id=\"sg89ae\">\n\
|
||||
<status>\n\
|
||||
<basic>closed</basic>\n\
|
||||
<es:activities>\n\
|
||||
<es:activity>permanent-absence</es:activity>\n\
|
||||
</es:activities>\n\
|
||||
</status>\n\
|
||||
</tuple>\n\
|
||||
\n</presence>\n");
|
||||
}
|
||||
osip_message_set_body(notify, buf, strlen(buf));
|
||||
osip_message_set_content_type(notify, "application/pidf+xml");
|
||||
}
|
||||
|
||||
static void add_presence_body(osip_message_t *notify, SalPresenceStatus online_status)
|
||||
{
|
||||
char buf[1000];
|
||||
char *contact_info;
|
||||
|
||||
osip_from_t *from=NULL;
|
||||
from=osip_message_get_from(notify);
|
||||
osip_uri_to_str(from->url,&contact_info);
|
||||
|
||||
mk_presence_body (online_status, contact_info, buf, sizeof (buf), presence_style);
|
||||
|
||||
osip_message_set_body(notify, buf, strlen(buf));
|
||||
osip_message_set_content_type(notify,
|
||||
presence_style ? "application/xpidf+xml" : "application/pidf+xml");
|
||||
|
||||
#endif
|
||||
osip_free(contact_info);
|
||||
}
|
||||
|
||||
|
|
@ -476,137 +598,10 @@ int sal_publish(SalOp *op, const char *from, const char *to, SalPresenceStatus p
|
|||
int i;
|
||||
char buf[1024];
|
||||
|
||||
if (presence_mode==SalPresenceOnline)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n\
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status>\n\
|
||||
<basic>open</basic>\n\
|
||||
</status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
<note>online</note>\n\
|
||||
</tuple>\n\
|
||||
</presence>",
|
||||
from, from);
|
||||
}
|
||||
else if (presence_mode==SalPresenceBusy
|
||||
||presence_mode==SalPresenceDonotdisturb)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n\
|
||||
xmlns:es=\"urn:ietf:params:xml:ns:pidf:status:rpid-status\"\n\
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status>\n\
|
||||
<basic>open</basic>\n\
|
||||
<es:activities>\n\
|
||||
<es:activity>busy</es:activity>\n\
|
||||
</es:activities>\n\
|
||||
</status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
<note>busy</note>\n\
|
||||
</tuple>\n\
|
||||
</presence>",
|
||||
from, from);
|
||||
}
|
||||
else if (presence_mode==SalPresenceBerightback)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n\
|
||||
xmlns:es=\"urn:ietf:params:xml:ns:pidf:status:rpid-status\"\n\
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status>\n\
|
||||
<basic>open</basic>\n\
|
||||
<es:activities>\n\
|
||||
<es:activity>in-transit</es:activity>\n\
|
||||
</es:activities>\n\
|
||||
</status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
<note>be right back</note>\n\
|
||||
</tuple>\n\
|
||||
</presence>",
|
||||
from,from);
|
||||
}
|
||||
else if (presence_mode==SalPresenceAway
|
||||
||presence_mode==SalPresenceMoved)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n\
|
||||
xmlns:es=\"urn:ietf:params:xml:ns:pidf:status:rpid-status\"\n\
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status>\n\
|
||||
<basic>open</basic>\n\
|
||||
<es:activities>\n\
|
||||
<es:activity>away</es:activity>\n\
|
||||
</es:activities>\n\
|
||||
</status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
<note>away</note>\n\
|
||||
</tuple>\n\
|
||||
</presence>",
|
||||
from, from);
|
||||
}
|
||||
else if (presence_mode==SalPresenceOnthephone)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n\
|
||||
xmlns:es=\"urn:ietf:params:xml:ns:pidf:status:rpid-status\"\n\
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status>\n\
|
||||
<basic>open</basic>\n\
|
||||
<es:activities>\n\
|
||||
<es:activity>on-the-phone</es:activity>\n\
|
||||
</es:activities>\n\
|
||||
</status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
<note>on the phone</note>\n\
|
||||
</tuple>\n\
|
||||
</presence>",
|
||||
from, from);
|
||||
}
|
||||
else if (presence_mode==SalPresenceOuttolunch)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n\
|
||||
xmlns:es=\"urn:ietf:params:xml:ns:pidf:status:rpid-status\"\n\
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status>\n\
|
||||
<basic>open</basic>\n\
|
||||
<es:activities>\n\
|
||||
<es:activity>meal</es:activity>\n\
|
||||
</es:activities>\n\
|
||||
</status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
<note>out to lunch</note>\n\
|
||||
</tuple>\n\
|
||||
</presence>",
|
||||
from, from);
|
||||
}
|
||||
else{
|
||||
/* offline */
|
||||
snprintf(buf, sizeof(buf), "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n\
|
||||
xmlns:es=\"urn:ietf:params:xml:ns:pidf:status:rpid-status\"\n\
|
||||
entity=\"%s\">\n%s",
|
||||
from,
|
||||
"<tuple id=\"sg89ae\">\n\
|
||||
<status>\n\
|
||||
<basic>closed</basic>\n\
|
||||
<es:activities>\n\
|
||||
<es:activity>permanent-absence</e:activity>\n\
|
||||
</es:activities>\n\
|
||||
</status>\n\
|
||||
</tuple>\n\
|
||||
\n</presence>\n");
|
||||
}
|
||||
mk_presence_body (presence_mode, from, buf, sizeof (buf), presence_style);
|
||||
|
||||
i = eXosip_build_publish(&pub,from, to, NULL, "presence", "1800", "application/pidf+xml", buf);
|
||||
i = eXosip_build_publish(&pub,from, to, NULL, "presence", "300",
|
||||
presence_style ? "application/xpidf+xml" : "application/pidf+xml", buf);
|
||||
if (i<0){
|
||||
ms_warning("Failed to build publish request.");
|
||||
return -1;
|
||||
|
|
@ -620,6 +615,7 @@ int sal_publish(SalOp *op, const char *from, const char *to, SalPresenceStatus p
|
|||
ms_message("Failed to send publish request.");
|
||||
return -1;
|
||||
}
|
||||
sal_add_other(sal_op_get_sal(op),op,pub);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -691,7 +687,8 @@ void sal_exosip_notify_recv(Sal *sal, eXosip_event_t *ev){
|
|||
}else if (strstr(body->body,"berightback")!=NULL
|
||||
|| strstr(body->body,"in-transit")!=NULL ){
|
||||
estatus=SalPresenceBerightback;
|
||||
}else if (strstr(body->body,"away")!=NULL){
|
||||
}else if (strstr(body->body,"away")!=NULL
|
||||
|| strstr(body->body,"idle")){
|
||||
estatus=SalPresenceAway;
|
||||
}else if (strstr(body->body,"onthephone")!=NULL
|
||||
|| strstr(body->body,"on-the-phone")!=NULL){
|
||||
|
|
@ -714,6 +711,15 @@ void sal_exosip_notify_recv(Sal *sal, eXosip_event_t *ev){
|
|||
ms_message("And outgoing subscription terminated by remote.");
|
||||
}
|
||||
sal->callbacks.notify_presence(op,op->sid!=-1 ? SalSubscribeActive : SalSubscribeTerminated, estatus,NULL);
|
||||
|
||||
/* try to detect presence message style used by server,
|
||||
* and switch our presence messages to servers style */
|
||||
if (strstr (body->body, "//IETF//DTD RFCxxxx XPIDF 1.0//EN") != NULL) {
|
||||
presence_style = RFCxxxx;
|
||||
} else if (strstr(body->body,"http://schemas.microsoft.com/2002/09/sip/presence")!=NULL) {
|
||||
presence_style = MSOLDPRES;
|
||||
}
|
||||
|
||||
osip_free(tmp);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -323,13 +323,14 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){
|
|||
payload_type_set_number(pt,ptn);
|
||||
/* get the rtpmap associated to this codec, if any */
|
||||
rtpmap=sdp_message_a_attr_value_get_with_pt(msg, i,ptn,"rtpmap");
|
||||
payload_type_fill_from_rtpmap(pt,rtpmap);
|
||||
/* get the fmtp, if any */
|
||||
fmtp=sdp_message_a_attr_value_get_with_pt(msg, i, ptn,"fmtp");
|
||||
payload_type_set_send_fmtp(pt,fmtp);
|
||||
stream->payloads=ms_list_append(stream->payloads,pt);
|
||||
ms_message("Found payload %s/%i fmtp=%s",pt->mime_type,pt->clock_rate,
|
||||
pt->send_fmtp ? pt->send_fmtp : "");
|
||||
if (payload_type_fill_from_rtpmap(pt,rtpmap)==0){
|
||||
/* get the fmtp, if any */
|
||||
fmtp=sdp_message_a_attr_value_get_with_pt(msg, i, ptn,"fmtp");
|
||||
payload_type_set_send_fmtp(pt,fmtp);
|
||||
stream->payloads=ms_list_append(stream->payloads,pt);
|
||||
ms_message("Found payload %s/%i fmtp=%s",pt->mime_type,pt->clock_rate,
|
||||
pt->send_fmtp ? pt->send_fmtp : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
desc->nstreams=i;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "linphonecore_utils.h"
|
||||
|
||||
|
||||
static void play_finished(LsdPlayer *p){
|
||||
const char *filename=(const char *)lsd_player_get_user_pointer (p);
|
||||
ms_message("Playing of %s is finished.",filename);
|
||||
|
|
@ -35,8 +36,8 @@ static void play_finished(LsdPlayer *p){
|
|||
}
|
||||
|
||||
static void wait_a_bit(LinphoneCore *lc, int seconds){
|
||||
time_t orig=time(NULL);
|
||||
while(time(NULL)-orig<seconds){
|
||||
time_t orig=ms_time(NULL);
|
||||
while(ms_time(NULL)-orig<seconds){
|
||||
/* we need to call iterate to receive notifications */
|
||||
linphone_core_iterate(lc);
|
||||
ms_usleep (50000);
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ linphone_3_SOURCES= \
|
|||
loginframe.c \
|
||||
linphone.h
|
||||
|
||||
linphone_3_LDADD=$(top_builddir)/oRTP/src/libortp.la \
|
||||
$(top_builddir)/mediastreamer2/src/libmediastreamer.la \
|
||||
linphone_3_LDADD=$(ORTP_LIBS) \
|
||||
$(MEDIASTREAMER_LIBS) \
|
||||
$(top_builddir)/coreapi/liblinphone.la \
|
||||
$(LIBGTK_LIBS) $(INTLLIBS)
|
||||
|
||||
|
|
@ -69,13 +69,13 @@ endif
|
|||
|
||||
|
||||
AM_CFLAGS= -DIN_LINPHONE -I$(top_srcdir)/coreapi/ \
|
||||
-I$(top_srcdir)/mediastreamer2/include/ \
|
||||
$(MEDIASTREAMER_CFLAGS) \
|
||||
$(ORTP_CFLAGS) \
|
||||
$(STRICT_OPTIONS) $(LIBGTK_CFLAGS) $(IPV6_CFLAGS) \
|
||||
$(OSIP_CFLAGS)
|
||||
|
||||
|
||||
version_date.h: $(top_srcdir)/configure.in
|
||||
version_date.h: $(top_srcdir)/configure.ac
|
||||
echo "#define LINPHONE_VERSION_DATE \"$(VERSION)-`date +%y%m%d`\"" > $@
|
||||
|
||||
newdate:
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<property name="has_separator">False</property>
|
||||
<property name="program_name">Linphone</property>
|
||||
<property name="version">undef</property>
|
||||
<property name="copyright" translatable="yes">Created by Simon Morlat
|
||||
<property name="copyright" translatable="yes">(C) Belledonne Communications,2010
|
||||
</property>
|
||||
<property name="comments" translatable="yes">An internet video phone using the standard SIP (rfc3261) protocol.</property>
|
||||
<property name="website">http://www.linphone.org</property>
|
||||
|
|
|
|||
|
|
@ -1,31 +1,40 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--Generated with glade3 3.4.5 on Wed Jul 30 17:55:28 2008 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="2.16"/>
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<object class="GtkListStore" id="call_logs_store">
|
||||
<columns>
|
||||
<!-- column-name icon -->
|
||||
<column type="gchar"/>
|
||||
<!-- column-name sipaddress -->
|
||||
<column type="gchar"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkDialog" id="call_logs">
|
||||
<property name="width_request">500</property>
|
||||
<property name="height_request">370</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Call history</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
|
||||
<property name="icon">linphone2.png</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="has_separator">False</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<property name="vscrollbar_policy">automatic</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="logtextview">
|
||||
<object class="GtkTreeView" id="logs_view">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="wrap_mode">GTK_WRAP_WORD</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<signal name="row_activated" handler="linphone_gtk_history_row_activated"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
@ -36,32 +45,65 @@
|
|||
<child internal-child="action_area">
|
||||
<object class="GtkHButtonBox" id="dialog-action_area1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label" translatable="yes">Clear all</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">image1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="call_back_button">
|
||||
<property name="label" translatable="yes">Call back</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="call_logs_close">
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="label" translatable="yes">gtk-close</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="0">button1</action-widget>
|
||||
<action-widget response="2">button1</action-widget>
|
||||
<action-widget response="1">call_back_button</action-widget>
|
||||
<action-widget response="0">call_logs_close</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-clear</property>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
|||
106
gtk/calllogs.c
106
gtk/calllogs.c
|
|
@ -21,47 +21,109 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
|
||||
void linphone_gtk_call_log_update(GtkWidget *w){
|
||||
GtkTextView *v=GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"logtextview"));
|
||||
GtkTextBuffer *b=gtk_text_view_get_buffer(v);
|
||||
GtkTextIter iter,begin;
|
||||
int off;
|
||||
char *logmsg;
|
||||
GtkTreeView *v=GTK_TREE_VIEW(linphone_gtk_get_widget(w,"logs_view"));
|
||||
GtkListStore *store;
|
||||
const MSList *logs;
|
||||
|
||||
store=(GtkListStore*)gtk_tree_view_get_model(v);
|
||||
if (store==NULL){
|
||||
store=gtk_list_store_new(3,G_TYPE_STRING,G_TYPE_STRING, G_TYPE_POINTER);
|
||||
gtk_tree_view_set_model(v,GTK_TREE_MODEL(store));
|
||||
g_object_unref(G_OBJECT(store));
|
||||
}
|
||||
gtk_list_store_clear (store);
|
||||
|
||||
for (logs=linphone_core_get_call_logs(linphone_gtk_get_core());logs!=NULL;logs=logs->next){
|
||||
LinphoneCallLog *cl=(LinphoneCallLog*)logs->data;
|
||||
logmsg=linphone_call_log_to_str(cl);
|
||||
gtk_text_buffer_get_end_iter(b,&iter);
|
||||
off=gtk_text_iter_get_offset(&iter);
|
||||
gtk_text_buffer_insert(b,&iter,logmsg,-1);
|
||||
gtk_text_buffer_get_end_iter(b,&iter);
|
||||
gtk_text_buffer_insert(b,&iter,"\n",-1);
|
||||
gtk_text_buffer_get_end_iter(b,&iter);
|
||||
gtk_text_buffer_get_iter_at_offset(b,&begin,off);
|
||||
gtk_text_buffer_apply_tag_by_name(b,cl->dir==LinphoneCallOutgoing ? "green" : "blue" ,&begin,&iter);
|
||||
ms_free(logmsg);
|
||||
GtkTreeIter iter;
|
||||
LinphoneAddress *la=cl->dir==LinphoneCallIncoming ? cl->from : cl->to;
|
||||
char *addr= linphone_address_as_string_uri_only (la);
|
||||
const char *display;
|
||||
gchar *logtxt;
|
||||
display=linphone_address_get_display_name (la);
|
||||
if (display==NULL){
|
||||
display=linphone_address_get_username (la);
|
||||
if (display==NULL)
|
||||
display=linphone_address_get_domain (la);
|
||||
}
|
||||
logtxt=g_markup_printf_escaped("<big><b>%s</b></big>\t<small><i>%s</i></small>\n"
|
||||
"%s\t%i minutes %i seconds",display, addr, cl->start_date,
|
||||
cl->duration/60,cl->duration%60);
|
||||
gtk_list_store_append (store,&iter);
|
||||
gtk_list_store_set (store,&iter,
|
||||
0, cl->dir==LinphoneCallOutgoing ? GTK_STOCK_GO_UP : GTK_STOCK_GO_DOWN,
|
||||
1, logtxt,2,la,-1);
|
||||
ms_free(addr);
|
||||
g_free(logtxt);
|
||||
}
|
||||
gtk_text_buffer_get_end_iter(b,&iter);
|
||||
gtk_text_view_scroll_to_iter(v,&iter,0,FALSE,0,0);
|
||||
|
||||
}
|
||||
|
||||
void linphone_gtk_call_log_response(GtkWidget *w){
|
||||
static bool_t put_selection_to_uribar(GtkWidget *treeview){
|
||||
GtkTreeSelection *sel;
|
||||
|
||||
sel=gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
|
||||
if (sel!=NULL){
|
||||
GtkTreeModel *model=NULL;
|
||||
GtkTreeIter iter;
|
||||
if (gtk_tree_selection_get_selected (sel,&model,&iter)){
|
||||
gpointer pla;
|
||||
LinphoneAddress *la;
|
||||
char *tmp;
|
||||
gtk_tree_model_get(model,&iter,2,&pla,-1);
|
||||
la=(LinphoneAddress*)pla;
|
||||
tmp=linphone_address_as_string (la);
|
||||
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"uribar")),tmp);
|
||||
ms_free(tmp);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void linphone_gtk_history_row_activated(GtkWidget *treeview){
|
||||
put_selection_to_uribar(treeview);
|
||||
}
|
||||
|
||||
void linphone_gtk_call_log_response(GtkWidget *w, guint response_id){
|
||||
GtkWidget *mw=linphone_gtk_get_main_window();
|
||||
if (response_id==1){
|
||||
if (put_selection_to_uribar(linphone_gtk_get_widget(w,"logs_view")))
|
||||
linphone_gtk_start_call(linphone_gtk_get_widget(mw,"start_call"));
|
||||
}else if (response_id==2){
|
||||
linphone_core_clear_call_logs (linphone_gtk_get_core());
|
||||
linphone_gtk_call_log_update(w);
|
||||
return;
|
||||
}
|
||||
g_object_set_data(G_OBJECT(mw),"call_logs",NULL);
|
||||
gtk_widget_destroy(w);
|
||||
}
|
||||
|
||||
|
||||
static void fill_renderers(GtkTreeView *v){
|
||||
GtkTreeViewColumn *c;
|
||||
GtkCellRenderer *r=gtk_cell_renderer_pixbuf_new ();
|
||||
|
||||
g_object_set(r,"stock-size",GTK_ICON_SIZE_BUTTON,NULL);
|
||||
c=gtk_tree_view_column_new_with_attributes("icon",r,"stock-id",0,NULL);
|
||||
gtk_tree_view_append_column (v,c);
|
||||
|
||||
r=gtk_cell_renderer_text_new ();
|
||||
c=gtk_tree_view_column_new_with_attributes("sipaddress",r,"markup",1,NULL);
|
||||
gtk_tree_view_append_column (v,c);
|
||||
}
|
||||
|
||||
GtkWidget * linphone_gtk_show_call_logs(void){
|
||||
GtkWidget *mw=linphone_gtk_get_main_window();
|
||||
GtkTextBuffer *b;
|
||||
GtkWidget *w=(GtkWidget*)g_object_get_data(G_OBJECT(linphone_gtk_get_main_window()),"call_logs");
|
||||
if (w==NULL){
|
||||
w=linphone_gtk_create_window("call_logs");
|
||||
gtk_button_set_image(GTK_BUTTON(linphone_gtk_get_widget(w,"call_back_button")),
|
||||
create_pixmap (linphone_gtk_get_ui_config("callback_button","status-green.png")));
|
||||
fill_renderers(GTK_TREE_VIEW(linphone_gtk_get_widget(w,"logs_view")));
|
||||
g_object_set_data(G_OBJECT(mw),"call_logs",w);
|
||||
g_signal_connect(G_OBJECT(w),"response",(GCallback)linphone_gtk_call_log_response,NULL);
|
||||
gtk_widget_show(w);
|
||||
b=gtk_text_view_get_buffer(GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"logtextview")));
|
||||
gtk_text_buffer_create_tag(b,"blue","foreground","blue",NULL);
|
||||
gtk_text_buffer_create_tag(b,"green","foreground","green",NULL);
|
||||
linphone_gtk_call_log_update(w);
|
||||
}else gtk_window_present(GTK_WINDOW(w));
|
||||
return w;
|
||||
|
|
|
|||
|
|
@ -94,13 +94,13 @@ void linphone_gtk_send_text(GtkWidget *button){
|
|||
}
|
||||
}
|
||||
|
||||
void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room, const char *from, const char *message){
|
||||
void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message){
|
||||
GtkWidget *w=(GtkWidget*)linphone_chat_room_get_user_data(room);
|
||||
if (w==NULL){
|
||||
w=linphone_gtk_init_chatroom(room,from);
|
||||
w=linphone_gtk_init_chatroom(room,linphone_address_as_string_uri_only(from));
|
||||
}
|
||||
linphone_gtk_push_text(GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textlog")),
|
||||
from,
|
||||
linphone_address_as_string_uri_only(from),
|
||||
message,FALSE);
|
||||
gtk_window_present(GTK_WINDOW(w));
|
||||
/*gtk_window_set_urgency_hint(GTK_WINDOW(w),TRUE);*/
|
||||
|
|
|
|||
|
|
@ -450,9 +450,12 @@ void linphone_gtk_contact_ok(GtkWidget *button){
|
|||
linphone_gtk_display_something(GTK_MESSAGE_WARNING,_("Invalid sip contact !"));
|
||||
return ;
|
||||
}
|
||||
linphone_friend_set_sip_addr(lf,fixed_uri);
|
||||
LinphoneAddress* friend_address = linphone_address_new(fixed_uri);
|
||||
linphone_address_set_display_name(friend_address,name);
|
||||
linphone_friend_set_addr(lf,friend_address);
|
||||
ms_free(fixed_uri);
|
||||
linphone_friend_set_name(lf,name);
|
||||
linphone_address_destroy(friend_address);
|
||||
|
||||
linphone_friend_send_subscribe(lf,show_presence);
|
||||
linphone_friend_set_inc_subscribe_policy(lf,allow_presence==TRUE ? LinphoneSPAccept : LinphoneSPDeny);
|
||||
if (linphone_friend_in_list(lf)) {
|
||||
|
|
|
|||
|
|
@ -142,13 +142,14 @@ void linphone_gtk_in_call_view_set_incoming(LinphoneCall *call, bool_t with_paus
|
|||
GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call);
|
||||
GtkWidget *status=linphone_gtk_get_widget(callview,"in_call_status");
|
||||
GtkWidget *callee=linphone_gtk_get_widget(callview,"in_call_uri");
|
||||
GtkWidget *duration=linphone_gtk_get_widget(callview,"in_call_duration");
|
||||
GtkWidget *animation=linphone_gtk_get_widget(callview,"in_call_animation");
|
||||
GdkPixbufAnimation *pbuf=create_pixbuf_animation("calling_anim.gif");
|
||||
GtkWidget *answer_button;
|
||||
|
||||
gtk_label_set_markup(GTK_LABEL(status),_("<b>Incoming call</b>"));
|
||||
gtk_widget_show_all(linphone_gtk_get_widget(callview,"answer_decline_panel"));
|
||||
gtk_widget_hide(linphone_gtk_get_widget(callview,"duration_frame"));
|
||||
gtk_widget_hide(linphone_gtk_get_widget(callview,"mute_pause_buttons"));
|
||||
display_peer_name_in_label(callee,linphone_call_get_remote_address (call));
|
||||
|
||||
answer_button=linphone_gtk_get_widget(callview,"accept_call");
|
||||
|
|
@ -161,7 +162,6 @@ void linphone_gtk_in_call_view_set_incoming(LinphoneCall *call, bool_t with_paus
|
|||
gtk_button_set_image(GTK_BUTTON(linphone_gtk_get_widget(callview,"decline_call")),
|
||||
create_pixmap (linphone_gtk_get_ui_config("stop_call_icon","stopcall-red.png")));
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(duration),_("00::00::00"));
|
||||
if (pbuf!=NULL){
|
||||
gtk_image_set_from_animation(GTK_IMAGE(animation),pbuf);
|
||||
g_object_unref(G_OBJECT(pbuf));
|
||||
|
|
@ -178,6 +178,8 @@ void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){
|
|||
|
||||
display_peer_name_in_label(callee,linphone_call_get_remote_address (call));
|
||||
|
||||
gtk_widget_show(linphone_gtk_get_widget(callview,"duration_frame"));
|
||||
gtk_widget_show(linphone_gtk_get_widget(callview,"mute_pause_buttons"));
|
||||
gtk_widget_hide(linphone_gtk_get_widget(callview,"answer_decline_panel"));
|
||||
gtk_label_set_markup(GTK_LABEL(status),_("<b>In call</b>"));
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ void linphone_gtk_set_my_presence(LinphoneOnlineStatus ss);
|
|||
void linphone_gtk_show_parameters(void);
|
||||
void linphone_gtk_load_identities(void);
|
||||
void linphone_gtk_create_chatroom(const char *with);
|
||||
void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room, const char *from, const char *message);
|
||||
void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message);
|
||||
void linphone_gtk_call_log_update(GtkWidget *w);
|
||||
void linphone_gtk_create_log_window(void);
|
||||
void linphone_gtk_log_show(void);
|
||||
|
|
@ -99,4 +99,5 @@ void linphone_gtk_enable_mute_button(GtkButton *button, gboolean sensitive);
|
|||
void linphone_gtk_enable_hold_button(LinphoneCall *call, gboolean sensitive, gboolean holdon);
|
||||
|
||||
void linphone_gtk_show_login_frame(LinphoneProxyConfig *cfg);
|
||||
|
||||
void linphone_gtk_exit_login_frame(void);
|
||||
void linphone_gtk_set_ui_config(const char *key, const char *value);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Linphone debug window</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="type_hint">normal</property>
|
||||
<property name="deletable">False</property>
|
||||
<property name="has_separator">False</property>
|
||||
<signal name="response" handler="gtk_widget_hide"/>
|
||||
|
|
|
|||
|
|
@ -27,28 +27,28 @@ enum {
|
|||
NetworkKindOpticalFiber
|
||||
};
|
||||
|
||||
static gboolean check_login_ok(LinphoneProxyConfig *cfg){
|
||||
if (linphone_proxy_config_is_registered(cfg)){
|
||||
linphone_gtk_exit_login_frame();
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void do_login(SipSetupContext *ssctx, const char *identity, const char * passwd){
|
||||
GtkWidget *mw=linphone_gtk_get_main_window();
|
||||
if (sip_setup_context_login_account(ssctx,identity,passwd)==0){
|
||||
guint t=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(mw),"login_tout"));
|
||||
if (t!=0) g_source_remove(t);
|
||||
t=g_timeout_add(50,(GSourceFunc)check_login_ok,sip_setup_context_get_proxy_config(ssctx));
|
||||
g_object_set_data(G_OBJECT(mw),"login_tout",GINT_TO_POINTER(t));
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean do_login_noprompt(LinphoneProxyConfig *cfg){
|
||||
SipSetupContext *ssctx=linphone_proxy_config_get_sip_setup_context(cfg);
|
||||
LinphoneAddress *addr;
|
||||
const char *username;
|
||||
char *tmp;
|
||||
if (ssctx==NULL) return TRUE;/*not ready ?*/
|
||||
do_login(ssctx,linphone_proxy_config_get_identity(cfg),NULL);
|
||||
username=linphone_gtk_get_ui_config ("login_username",NULL);
|
||||
if (username==NULL) {
|
||||
linphone_gtk_set_ui_config_int("automatic_login",0);
|
||||
linphone_gtk_show_login_frame(cfg);
|
||||
return FALSE;
|
||||
}
|
||||
addr=linphone_address_new(linphone_proxy_config_get_identity(cfg));
|
||||
linphone_address_set_username(addr,username);
|
||||
tmp=linphone_address_as_string (addr);
|
||||
do_login(ssctx,tmp,NULL);
|
||||
linphone_address_destroy(addr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -75,17 +75,32 @@ void linphone_gtk_show_login_frame(LinphoneProxyConfig *cfg){
|
|||
return;
|
||||
}
|
||||
|
||||
gtk_widget_hide(linphone_gtk_get_widget(mw,"logout"));
|
||||
gtk_widget_hide(linphone_gtk_get_widget(mw,"idle_frame"));
|
||||
{
|
||||
const char *login_image=linphone_gtk_get_ui_config("login_image",NULL);
|
||||
if (login_image){
|
||||
GdkPixbuf *pbuf=create_pixbuf (login_image);
|
||||
gtk_image_set_from_pixbuf (GTK_IMAGE(linphone_gtk_get_widget(mw,"login_image")),
|
||||
pbuf);
|
||||
g_object_unref(G_OBJECT(pbuf));
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_hide(linphone_gtk_get_widget(mw,"disconnect_item"));
|
||||
gtk_widget_hide(linphone_gtk_get_widget(mw,"main_frame"));
|
||||
gtk_widget_show(linphone_gtk_get_widget(mw,"login_frame"));
|
||||
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"main_menu"),FALSE);
|
||||
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"modes"),FALSE);
|
||||
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"options_menu"),FALSE);
|
||||
str=g_strdup_printf(_("Please enter login information for %s"),linphone_proxy_config_get_domain(cfg));
|
||||
gtk_label_set_text(GTK_LABEL(label),str);
|
||||
g_object_set_data(G_OBJECT(mw),"login_proxy_config",cfg);
|
||||
g_free(str);
|
||||
|
||||
from=linphone_address_new(linphone_proxy_config_get_identity(cfg));
|
||||
if (linphone_address_get_username(from)[0]=='?'){
|
||||
const char *username=linphone_gtk_get_ui_config ("login_username",NULL);
|
||||
if (username)
|
||||
linphone_address_set_username(from,username);
|
||||
}
|
||||
|
||||
ai=linphone_core_find_auth_info(lc,linphone_proxy_config_get_domain(cfg),linphone_address_get_username(from));
|
||||
/*display the last entered username, if not '?????'*/
|
||||
|
|
@ -101,11 +116,11 @@ void linphone_gtk_show_login_frame(LinphoneProxyConfig *cfg){
|
|||
|
||||
void linphone_gtk_exit_login_frame(void){
|
||||
GtkWidget *mw=linphone_gtk_get_main_window();
|
||||
gtk_widget_show(linphone_gtk_get_widget(mw,"idle_frame"));
|
||||
gtk_widget_show(linphone_gtk_get_widget(mw,"main_frame"));
|
||||
gtk_widget_hide(linphone_gtk_get_widget(mw,"login_frame"));
|
||||
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"main_menu"),TRUE);
|
||||
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"modes"),TRUE);
|
||||
gtk_widget_show(linphone_gtk_get_widget(mw,"logout"));
|
||||
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"options_menu"),TRUE);
|
||||
gtk_widget_show(linphone_gtk_get_widget(mw,"disconnect_item"));
|
||||
}
|
||||
|
||||
void linphone_gtk_logout_clicked(){
|
||||
|
|
@ -142,6 +157,7 @@ void linphone_gtk_login_frame_connect_clicked(GtkWidget *button){
|
|||
|
||||
autologin=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(mw,"automatic_login")));
|
||||
linphone_gtk_set_ui_config_int("automatic_login",autologin);
|
||||
linphone_gtk_set_ui_config("login_username",username);
|
||||
|
||||
from=linphone_address_new(linphone_proxy_config_get_identity(cfg));
|
||||
linphone_address_set_username(from,username);
|
||||
|
|
|
|||
88
gtk/main.c
88
gtk/main.c
|
|
@ -41,6 +41,7 @@ const char *this_program_ident_string="linphone_ident_string=" LINPHONE_VERSION;
|
|||
static LinphoneCore *the_core=NULL;
|
||||
static GtkWidget *the_ui=NULL;
|
||||
|
||||
static void linphone_gtk_registration_state_changed(LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState rs, const char *msg);
|
||||
static void linphone_gtk_show(LinphoneCore *lc);
|
||||
static void linphone_gtk_notify_recv(LinphoneCore *lc, LinphoneFriend * fid);
|
||||
static void linphone_gtk_new_unknown_subscriber(LinphoneCore *lc, LinphoneFriend *lf, const char *url);
|
||||
|
|
@ -94,7 +95,7 @@ static GOptionEntry linphone_options[]={
|
|||
.description = N_("if set automatically answer incoming calls")
|
||||
},
|
||||
#ifdef WIN32
|
||||
{ /* zsd addition */
|
||||
{
|
||||
.long_name = "workdir",
|
||||
.short_name = '\0',
|
||||
.arg = G_OPTION_ARG_STRING,
|
||||
|
|
@ -193,9 +194,10 @@ static void linphone_gtk_init_liblinphone(const char *config_file,
|
|||
LinphoneCoreVTable vtable={0};
|
||||
|
||||
vtable.call_state_changed=linphone_gtk_call_state_changed;
|
||||
vtable.registration_state_changed=linphone_gtk_registration_state_changed;
|
||||
vtable.show=linphone_gtk_show;
|
||||
vtable.notify_presence_recv=linphone_gtk_notify_recv;
|
||||
vtable.new_unknown_subscriber=linphone_gtk_new_unknown_subscriber;
|
||||
vtable.new_subscription_request=linphone_gtk_new_unknown_subscriber;
|
||||
vtable.auth_info_requested=linphone_gtk_auth_info_requested;
|
||||
vtable.display_status=linphone_gtk_display_status;
|
||||
vtable.display_message=linphone_gtk_display_message;
|
||||
|
|
@ -413,8 +415,10 @@ void linphone_gtk_show_about(){
|
|||
struct stat filestat;
|
||||
const char *license_file=PACKAGE_DATA_DIR "/linphone/COPYING";
|
||||
GtkWidget *about;
|
||||
const char *tmp;
|
||||
GdkPixbuf *logo=create_pixbuf(
|
||||
linphone_gtk_get_ui_config("logo","linphone-banner.png"));
|
||||
static const char *defcfg="defcfg";
|
||||
|
||||
about=linphone_gtk_create_window("about");
|
||||
gtk_about_dialog_set_url_hook(about_url_clicked,NULL,NULL);
|
||||
|
|
@ -436,7 +440,19 @@ void linphone_gtk_show_about(){
|
|||
gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(about),linphone_gtk_get_ui_config("title","Linphone"));
|
||||
gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(about),linphone_gtk_get_ui_config("home","http://www.linphone.org"));
|
||||
if (logo) gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(about),logo);
|
||||
|
||||
tmp=linphone_gtk_get_ui_config("artists",defcfg);
|
||||
if (tmp!=defcfg){
|
||||
const char *tmp2[2];
|
||||
tmp2[0]=tmp;
|
||||
tmp2[1]=NULL;
|
||||
gtk_about_dialog_set_artists(GTK_ABOUT_DIALOG(about),tmp2);
|
||||
}
|
||||
tmp=linphone_gtk_get_ui_config("translators",defcfg);
|
||||
if (tmp!=defcfg)
|
||||
gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG(about),tmp);
|
||||
tmp=linphone_gtk_get_ui_config("comments",defcfg);
|
||||
if (tmp!=defcfg)
|
||||
gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(about),tmp);
|
||||
gtk_widget_show(about);
|
||||
}
|
||||
|
||||
|
|
@ -633,12 +649,14 @@ static gboolean in_call_timer(){
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static bool_t all_calls_paused(const MSList *calls){
|
||||
static bool_t all_other_calls_paused(LinphoneCall *refcall, const MSList *calls){
|
||||
for(;calls!=NULL;calls=calls->next){
|
||||
LinphoneCall *call=(LinphoneCall*)calls->data;
|
||||
LinphoneCallState cs=linphone_call_get_state(call);
|
||||
if (cs!=LinphoneCallPaused && cs!=LinphoneCallIncomingReceived && cs!=LinphoneCallPausing)
|
||||
return FALSE;
|
||||
if (refcall!=call){
|
||||
if (cs!=LinphoneCallPaused && cs!=LinphoneCallPausing)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -657,11 +675,17 @@ static void linphone_gtk_update_call_buttons(LinphoneCall *call){
|
|||
stop_active=FALSE;
|
||||
}else{
|
||||
stop_active=TRUE;
|
||||
if (all_calls_paused(calls)){
|
||||
if (all_other_calls_paused(NULL,calls)){
|
||||
start_active=TRUE;
|
||||
add_call=TRUE;
|
||||
}else if (call!=NULL && linphone_call_get_state(call)==LinphoneCallIncomingReceived){
|
||||
start_active=TRUE;
|
||||
}else if (call!=NULL && linphone_call_get_state(call)==LinphoneCallIncomingReceived && all_other_calls_paused(call,calls)){
|
||||
if (ms_list_size(calls)>1){
|
||||
start_active=TRUE;
|
||||
add_call=TRUE;
|
||||
}else{
|
||||
start_active=TRUE;
|
||||
add_call=FALSE;
|
||||
}
|
||||
}else{
|
||||
start_active=FALSE;
|
||||
}
|
||||
|
|
@ -953,7 +977,7 @@ static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call
|
|||
break;
|
||||
case LinphoneCallIncomingReceived:
|
||||
linphone_gtk_create_in_call_view (call);
|
||||
linphone_gtk_in_call_view_set_incoming(call,!all_calls_paused (linphone_core_get_calls(lc)));
|
||||
linphone_gtk_in_call_view_set_incoming(call,!all_other_calls_paused (call,linphone_core_get_calls(lc)));
|
||||
if (auto_answer) {
|
||||
linphone_call_ref(call);
|
||||
g_timeout_add(2000,(GSourceFunc)linphone_gtk_auto_answer ,call);
|
||||
|
|
@ -977,6 +1001,23 @@ static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call
|
|||
linphone_gtk_update_call_buttons (call);
|
||||
}
|
||||
|
||||
static void linphone_gtk_registration_state_changed(LinphoneCore *lc, LinphoneProxyConfig *cfg,
|
||||
LinphoneRegistrationState rs, const char *msg){
|
||||
switch (rs){
|
||||
case LinphoneRegistrationOk:
|
||||
if (cfg){
|
||||
SipSetup *ss=linphone_proxy_config_get_sip_setup(cfg);
|
||||
if (ss && (sip_setup_get_capabilities(ss) & SIP_SETUP_CAP_LOGIN)){
|
||||
linphone_gtk_exit_login_frame();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void icon_popup_menu(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data){
|
||||
GtkWidget *menu=(GtkWidget*)g_object_get_data(G_OBJECT(status_icon),"menu");
|
||||
gtk_menu_popup(GTK_MENU(menu),NULL,NULL,gtk_status_icon_position_menu,status_icon,button,activate_time);
|
||||
|
|
@ -1080,24 +1121,29 @@ void linphone_gtk_load_identities(void){
|
|||
gtk_combo_box_set_active(box,def_index);
|
||||
}
|
||||
|
||||
static void linphone_gtk_dtmf_clicked(GtkButton *button){
|
||||
static void linphone_gtk_dtmf_pressed(GtkButton *button){
|
||||
const char *label=gtk_button_get_label(button);
|
||||
GtkWidget *uri_bar=linphone_gtk_get_widget(gtk_widget_get_toplevel(GTK_WIDGET(button)),"uribar");
|
||||
int pos=-1;
|
||||
gtk_editable_insert_text(GTK_EDITABLE(uri_bar),label,1,&pos);
|
||||
linphone_core_play_dtmf (linphone_gtk_get_core(),label[0],100);
|
||||
linphone_core_play_dtmf (linphone_gtk_get_core(),label[0],-1);
|
||||
if (linphone_core_in_call(linphone_gtk_get_core())){
|
||||
linphone_core_send_dtmf(linphone_gtk_get_core(),label[0]);
|
||||
}
|
||||
}
|
||||
|
||||
static void linphone_gtk_dtmf_released(GtkButton *button){
|
||||
linphone_core_stop_dtmf (linphone_gtk_get_core());
|
||||
}
|
||||
|
||||
static void linphone_gtk_connect_digits(void){
|
||||
GtkContainer *cont=GTK_CONTAINER(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"dtmf_table"));
|
||||
GList *children=gtk_container_get_children(cont);
|
||||
GList *elem;
|
||||
for(elem=children;elem!=NULL;elem=elem->next){
|
||||
GtkButton *button=GTK_BUTTON(elem->data);
|
||||
g_signal_connect(G_OBJECT(button),"clicked",(GCallback)linphone_gtk_dtmf_clicked,NULL);
|
||||
g_signal_connect(G_OBJECT(button),"pressed",(GCallback)linphone_gtk_dtmf_pressed,NULL);
|
||||
g_signal_connect(G_OBJECT(button),"released",(GCallback)linphone_gtk_dtmf_released,NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1133,6 +1179,7 @@ static void linphone_gtk_configure_main_window(){
|
|||
static const char *search_icon;
|
||||
static gboolean update_check_menu;
|
||||
static gboolean buttons_have_borders;
|
||||
static gboolean show_abcd;
|
||||
GtkWidget *w=linphone_gtk_get_main_window();
|
||||
if (!config_loaded){
|
||||
title=linphone_gtk_get_ui_config("title","Linphone");
|
||||
|
|
@ -1143,6 +1190,7 @@ static void linphone_gtk_configure_main_window(){
|
|||
search_icon=linphone_gtk_get_ui_config("directory_search_icon",NULL);
|
||||
update_check_menu=linphone_gtk_get_ui_config_int("update_check_menu",0);
|
||||
buttons_have_borders=linphone_gtk_get_ui_config_int("buttons_border",1);
|
||||
show_abcd=linphone_gtk_get_ui_config_int("show_abcd",1);
|
||||
config_loaded=TRUE;
|
||||
}
|
||||
linphone_gtk_configure_window(w,"main_window");
|
||||
|
|
@ -1200,6 +1248,13 @@ static void linphone_gtk_configure_main_window(){
|
|||
if (update_check_menu){
|
||||
gtk_widget_show(linphone_gtk_get_widget(w,"versioncheck_item"));
|
||||
}
|
||||
if (!show_abcd){
|
||||
gtk_widget_hide(linphone_gtk_get_widget(w,"dtmf_A"));
|
||||
gtk_widget_hide(linphone_gtk_get_widget(w,"dtmf_B"));
|
||||
gtk_widget_hide(linphone_gtk_get_widget(w,"dtmf_C"));
|
||||
gtk_widget_hide(linphone_gtk_get_widget(w,"dtmf_D"));
|
||||
gtk_table_resize(GTK_TABLE(linphone_gtk_get_widget(w,"dtmf_table")),4,3);
|
||||
}
|
||||
}
|
||||
|
||||
void linphone_gtk_manage_login(void){
|
||||
|
|
@ -1215,7 +1270,7 @@ void linphone_gtk_manage_login(void){
|
|||
}
|
||||
|
||||
|
||||
void linphone_gtk_close(GtkWidget *mw){
|
||||
gboolean linphone_gtk_close(GtkWidget *mw){
|
||||
/*shutdown calls if any*/
|
||||
LinphoneCore *lc=linphone_gtk_get_core();
|
||||
if (linphone_core_in_call(lc)){
|
||||
|
|
@ -1223,6 +1278,7 @@ void linphone_gtk_close(GtkWidget *mw){
|
|||
}
|
||||
linphone_core_enable_video_preview(lc,FALSE);
|
||||
gtk_widget_hide(mw);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void linphone_gtk_init_main_window(){
|
||||
|
|
@ -1253,7 +1309,7 @@ void linphone_gtk_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){
|
|||
if (verbose){
|
||||
const char *lname="undef";
|
||||
char *msg;
|
||||
#ifdef __linux
|
||||
#if defined(__linux) || defined(__APPLE__)
|
||||
va_list cap;/*copy of our argument list: a va_list cannot be re-used (SIGSEGV on linux 64 bits)*/
|
||||
#endif
|
||||
switch(lev){
|
||||
|
|
@ -1275,7 +1331,7 @@ void linphone_gtk_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){
|
|||
default:
|
||||
g_error("Bad level !");
|
||||
}
|
||||
#ifdef __linux
|
||||
#if defined(__linux) || defined(__APPLE__)
|
||||
va_copy(cap,args);
|
||||
msg=g_strdup_vprintf(fmt,cap);
|
||||
va_end(cap);
|
||||
|
|
|
|||
123
gtk/main.ui
123
gtk/main.ui
|
|
@ -128,7 +128,7 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="menuitem3">
|
||||
<object class="GtkMenuItem" id="options_menu">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Options</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
|
@ -176,7 +176,7 @@
|
|||
<child>
|
||||
<object class="GtkMenuItem" id="menuitem4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Aid_e</property>
|
||||
<property name="label" translatable="yes">_Help</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="menu3">
|
||||
|
|
@ -523,6 +523,28 @@
|
|||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="add_contact_button">
|
||||
<property name="label" translatable="yes">Add contact</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">image6</property>
|
||||
<signal name="clicked" handler="linphone_gtk_add_contact"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
@ -617,44 +639,17 @@
|
|||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox9">
|
||||
<object class="GtkComboBox" id="identities">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="model">model3</property>
|
||||
<property name="active">0</property>
|
||||
<signal name="changed" handler="linphone_gtk_used_identity_changed"/>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment8">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="identities">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="model">model3</property>
|
||||
<property name="active">0</property>
|
||||
<signal name="changed" handler="linphone_gtk_used_identity_changed"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="renderer3"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="presence_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal name="clicked" handler="linphone_gtk_my_presence_clicked"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
<object class="GtkCellRendererText" id="renderer3"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
|
@ -1087,6 +1082,7 @@
|
|||
<child>
|
||||
<object class="GtkFrame" id="login_frame">
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">etched-out</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment2">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -1095,10 +1091,20 @@
|
|||
<object class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="login_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame5">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment3">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -1211,7 +1217,8 @@
|
|||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
<property name="padding">10</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -1234,7 +1241,7 @@
|
|||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
@ -1259,10 +1266,32 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStatusbar" id="status_bar">
|
||||
<object class="GtkHBox" id="hbox4">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkStatusbar" id="status_bar">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="spacing">2</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="presence_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="clicked" handler="linphone_gtk_my_presence_clicked"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
|
@ -1376,7 +1405,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame1">
|
||||
<object class="GtkFrame" id="duration_frame">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<child>
|
||||
|
|
@ -1409,7 +1438,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHButtonBox" id="hbuttonbox4">
|
||||
<object class="GtkHButtonBox" id="mute_pause_buttons">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">spread</property>
|
||||
<child>
|
||||
|
|
@ -1462,4 +1491,8 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkImage" id="image6">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
|||
|
|
@ -1,55 +1,64 @@
|
|||
<?xml version="1.0"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="2.16"/>
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<object class="GtkAdjustment" id="adjustment1">
|
||||
<property name="upper">3001</property>
|
||||
<property name="lower">500</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_size">10</property>
|
||||
<property name="value">500</property>
|
||||
<property name="lower">500</property>
|
||||
<property name="upper">3001</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="page_size">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adjustment2">
|
||||
<property name="upper">65535</property>
|
||||
<property name="lower">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_size">10</property>
|
||||
<property name="value">1</property>
|
||||
<property name="lower">1</property>
|
||||
<property name="upper">65535</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="page_size">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adjustment3">
|
||||
<property name="upper">65535</property>
|
||||
<property name="lower">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_size">10</property>
|
||||
<property name="value">1</property>
|
||||
<property name="lower">1</property>
|
||||
<property name="upper">65535</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="page_size">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adjustment4">
|
||||
<property name="upper">65535</property>
|
||||
<property name="lower">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_size">10</property>
|
||||
<property name="value">1</property>
|
||||
<property name="lower">0</property>
|
||||
<property name="upper">65535</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="page_size">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adjustment_tcp_port">
|
||||
<property name="value">1</property>
|
||||
<property name="lower">0</property>
|
||||
<property name="upper">65535</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="page_size">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adjustment5">
|
||||
<property name="upper">100000</property>
|
||||
<property name="lower">-1</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="upper">100000</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="page_size">10</property>
|
||||
<property name="value">0</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adjustment6">
|
||||
<property name="upper">100000</property>
|
||||
<property name="lower">-1</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="upper">100000</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="page_size">10</property>
|
||||
<property name="value">0</property>
|
||||
</object>
|
||||
<object class="GtkListStore" id="model1">
|
||||
<columns>
|
||||
<!-- column-name gchararray -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
|
|
@ -60,6 +69,7 @@
|
|||
</object>
|
||||
<object class="GtkListStore" id="model2">
|
||||
<columns>
|
||||
<!-- column-name gchararray -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
|
|
@ -70,6 +80,7 @@
|
|||
</object>
|
||||
<object class="GtkListStore" id="model3">
|
||||
<columns>
|
||||
<!-- column-name gchararray -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
|
|
@ -80,6 +91,7 @@
|
|||
</object>
|
||||
<object class="GtkListStore" id="model4">
|
||||
<columns>
|
||||
<!-- column-name gchararray -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
|
|
@ -90,6 +102,7 @@
|
|||
</object>
|
||||
<object class="GtkListStore" id="model5">
|
||||
<columns>
|
||||
<!-- column-name gchararray -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
|
|
@ -100,6 +113,7 @@
|
|||
</object>
|
||||
<object class="GtkListStore" id="model6">
|
||||
<columns>
|
||||
<!-- column-name gchararray -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
|
|
@ -113,6 +127,7 @@
|
|||
</object>
|
||||
<object class="GtkListStore" id="model7">
|
||||
<columns>
|
||||
<!-- column-name gchararray -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
|
|
@ -121,8 +136,6 @@
|
|||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<!-- interface-requires gtk+ 2.16 -->
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<object class="GtkWindow" id="parameters">
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="title" translatable="yes">Settings</property>
|
||||
|
|
@ -166,7 +179,7 @@
|
|||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal handler="linphone_gtk_mtu_set" name="toggled"/>
|
||||
<signal name="toggled" handler="linphone_gtk_mtu_set"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
|
|
@ -177,7 +190,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="adjustment">adjustment1</property>
|
||||
<signal handler="linphone_gtk_mtu_changed" name="value_changed"/>
|
||||
<signal name="value_changed" handler="linphone_gtk_mtu_changed"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
|
|
@ -195,7 +208,7 @@
|
|||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal handler="linphone_gtk_use_sip_info_dtmf_toggled" name="toggled"/>
|
||||
<signal name="toggled" handler="linphone_gtk_use_sip_info_dtmf_toggled"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
|
|
@ -209,7 +222,7 @@
|
|||
<property name="receives_default">False</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal handler="linphone_gtk_ipv6_toggled" name="toggled"/>
|
||||
<signal name="toggled" handler="linphone_gtk_ipv6_toggled"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
|
|
@ -247,7 +260,7 @@
|
|||
<object class="GtkTable" id="table1">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="n_rows">3</property>
|
||||
<property name="n_rows">4</property>
|
||||
<property name="n_columns">2</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="video_rtp_port">
|
||||
|
|
@ -255,7 +268,22 @@
|
|||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="adjustment">adjustment2</property>
|
||||
<signal handler="linphone_gtk_video_port_changed" name="value_changed"/>
|
||||
<signal name="value_changed" handler="linphone_gtk_video_port_changed"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="audio_rtp_port">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="adjustment">adjustment3</property>
|
||||
<signal name="value_changed" handler="linphone_gtk_audio_port_changed"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
|
@ -265,12 +293,12 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="audio_rtp_port">
|
||||
<object class="GtkSpinButton" id="tcp_sip_port">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="adjustment">adjustment3</property>
|
||||
<signal handler="linphone_gtk_audio_port_changed" name="value_changed"/>
|
||||
<property name="adjustment">adjustment_tcp_port</property>
|
||||
<signal name="value_changed" handler="linphone_gtk_tcp_sip_port_changed"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
|
@ -280,12 +308,12 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="sip_port">
|
||||
<object class="GtkSpinButton" id="udp_sip_port">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="adjustment">adjustment4</property>
|
||||
<signal handler="linphone_gtk_sip_port_changed" name="value_changed"/>
|
||||
<signal name="value_changed" handler="linphone_gtk_udp_sip_port_changed"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
|
@ -300,8 +328,8 @@
|
|||
<property name="justify">right</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -311,6 +339,18 @@
|
|||
<property name="label" translatable="yes">Audio RTP/UDP:</property>
|
||||
<property name="justify">right</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label_tcp_port">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label" translatable="yes">SIP (TCP):</property>
|
||||
<property name="justify">right</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
|
|
@ -359,7 +399,7 @@
|
|||
<property name="receives_default">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal handler="linphone_gtk_no_firewall_toggled" name="toggled"/>
|
||||
<signal name="toggled" handler="linphone_gtk_no_firewall_toggled"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
|
@ -380,7 +420,7 @@
|
|||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">no_nat</property>
|
||||
<signal handler="linphone_gtk_use_nat_address_toggled" name="toggled"/>
|
||||
<signal name="toggled" handler="linphone_gtk_use_nat_address_toggled"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
|
|
@ -406,7 +446,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<signal handler="linphone_gtk_nat_address_changed" name="changed"/>
|
||||
<signal name="changed" handler="linphone_gtk_nat_address_changed"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
|
|
@ -437,7 +477,7 @@
|
|||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">no_nat</property>
|
||||
<signal handler="linphone_gtk_use_stun_toggled" name="toggled"/>
|
||||
<signal name="toggled" handler="linphone_gtk_use_stun_toggled"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
|
|
@ -463,7 +503,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<signal handler="linphone_gtk_stun_server_changed" name="changed"/>
|
||||
<signal name="changed" handler="linphone_gtk_stun_server_changed"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
|
|
@ -557,7 +597,7 @@
|
|||
<object class="GtkFileChooserButton" id="ring_chooser">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<signal handler="linphone_gtk_ring_file_set" name="file_set"/>
|
||||
<signal name="file_set" handler="linphone_gtk_ring_file_set"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
|
|
@ -571,7 +611,7 @@
|
|||
<property name="receives_default">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal handler="linphone_gtk_play_ring_file" name="clicked"/>
|
||||
<signal name="clicked" handler="linphone_gtk_play_ring_file"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
|
|
@ -603,7 +643,7 @@
|
|||
<object class="GtkEntry" id="alsa_dev">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<signal handler="linphone_gtk_alsa_special_device_changed" name="editing_done"/>
|
||||
<signal name="editing_done" handler="linphone_gtk_alsa_special_device_changed"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
|
@ -617,8 +657,8 @@
|
|||
<object class="GtkComboBox" id="capture_device">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<signal handler="linphone_gtk_capture_device_changed" name="changed"/>
|
||||
<property name="model">model1</property>
|
||||
<signal name="changed" handler="linphone_gtk_capture_device_changed"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="renderer1"/>
|
||||
<attributes>
|
||||
|
|
@ -638,8 +678,8 @@
|
|||
<object class="GtkComboBox" id="ring_device">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<signal handler="linphone_gtk_ring_device_changed" name="changed"/>
|
||||
<property name="model">model2</property>
|
||||
<signal name="changed" handler="linphone_gtk_ring_device_changed"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="renderer2"/>
|
||||
<attributes>
|
||||
|
|
@ -709,8 +749,8 @@
|
|||
<object class="GtkComboBox" id="playback_device">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<signal handler="linphone_gtk_playback_device_changed" name="changed"/>
|
||||
<property name="model">model3</property>
|
||||
<signal name="changed" handler="linphone_gtk_playback_device_changed"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="renderer3"/>
|
||||
<attributes>
|
||||
|
|
@ -732,7 +772,7 @@
|
|||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal handler="linphone_gtk_echo_cancelation_toggled" name="toggled"/>
|
||||
<signal name="toggled" handler="linphone_gtk_echo_cancelation_toggled"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
|
@ -762,7 +802,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame4">
|
||||
<object class="GtkFrame" id="video_frame">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<child>
|
||||
|
|
@ -787,8 +827,8 @@
|
|||
<child>
|
||||
<object class="GtkComboBox" id="webcams">
|
||||
<property name="visible">True</property>
|
||||
<signal handler="linphone_gtk_cam_changed" name="changed"/>
|
||||
<property name="model">model4</property>
|
||||
<signal name="changed" handler="linphone_gtk_cam_changed"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="renderer4"/>
|
||||
<attributes>
|
||||
|
|
@ -815,9 +855,9 @@
|
|||
<child>
|
||||
<object class="GtkComboBox" id="video_size">
|
||||
<property name="visible">True</property>
|
||||
<property name="active">0</property>
|
||||
<signal handler="linphone_gtk_video_size_changed" name="changed"/>
|
||||
<property name="model">model5</property>
|
||||
<property name="active">0</property>
|
||||
<signal name="changed" handler="linphone_gtk_video_size_changed"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="renderer5"/>
|
||||
<attributes>
|
||||
|
|
@ -837,7 +877,7 @@
|
|||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="video_frame">
|
||||
<object class="GtkLabel" id="video_frame_title">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Video</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
|
|
@ -850,6 +890,9 @@
|
|||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkHBox" id="hbox11">
|
||||
|
|
@ -890,7 +933,7 @@
|
|||
<object class="GtkFrame" id="frame11">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="tooltip-text" translatable="yes">This section defines your SIP address when not using a SIP account</property>
|
||||
<property name="tooltip_text" translatable="yes">This section defines your SIP address when not using a SIP account</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment11">
|
||||
|
|
@ -915,7 +958,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<signal handler="linphone_gtk_update_my_contact" name="changed"/>
|
||||
<signal name="changed" handler="linphone_gtk_update_my_contact"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
|
@ -949,7 +992,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<signal handler="linphone_gtk_update_my_contact" name="changed"/>
|
||||
<signal name="changed" handler="linphone_gtk_update_my_contact"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
|
@ -1033,7 +1076,7 @@
|
|||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<signal handler="linphone_gtk_add_proxy" name="clicked"/>
|
||||
<signal name="clicked" handler="linphone_gtk_add_proxy"/>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox14">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -1073,7 +1116,7 @@
|
|||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<signal handler="linphone_gtk_edit_proxy" name="clicked"/>
|
||||
<signal name="clicked" handler="linphone_gtk_edit_proxy"/>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox16">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -1113,7 +1156,7 @@
|
|||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<signal handler="linphone_gtk_remove_proxy" name="clicked"/>
|
||||
<signal name="clicked" handler="linphone_gtk_remove_proxy"/>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox7">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -1151,7 +1194,7 @@
|
|||
<object class="GtkButton" id="create_phonics">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal handler="linphone_gtk_create_fonics_account" name="clicked"/>
|
||||
<signal name="clicked" handler="linphone_gtk_create_fonics_account"/>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -1227,7 +1270,7 @@ virtual network !</property>
|
|||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<signal handler="linphone_gtk_clear_passwords" name="clicked"/>
|
||||
<signal name="clicked" handler="linphone_gtk_clear_passwords"/>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox18">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -1279,6 +1322,9 @@ virtual network !</property>
|
|||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkHBox" id="hbox10">
|
||||
|
|
@ -1334,9 +1380,9 @@ virtual network !</property>
|
|||
<object class="GtkComboBox" id="codec_view">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="active">0</property>
|
||||
<signal handler="linphone_gtk_codec_view_changed" name="changed"/>
|
||||
<property name="model">model6</property>
|
||||
<property name="active">0</property>
|
||||
<signal name="changed" handler="linphone_gtk_codec_view_changed"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="renderer6"/>
|
||||
<attributes>
|
||||
|
|
@ -1387,7 +1433,7 @@ virtual network !</property>
|
|||
<property name="receives_default">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal handler="linphone_gtk_codec_up" name="clicked"/>
|
||||
<signal name="clicked" handler="linphone_gtk_codec_up"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
|
@ -1403,7 +1449,7 @@ virtual network !</property>
|
|||
<property name="receives_default">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal handler="linphone_gtk_codec_down" name="clicked"/>
|
||||
<signal name="clicked" handler="linphone_gtk_codec_down"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
|
@ -1417,7 +1463,7 @@ virtual network !</property>
|
|||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<signal handler="linphone_gtk_codec_enable" name="clicked"/>
|
||||
<signal name="clicked" handler="linphone_gtk_codec_enable"/>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox8">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -1457,7 +1503,7 @@ virtual network !</property>
|
|||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<signal handler="linphone_gtk_codec_disable" name="clicked"/>
|
||||
<signal name="clicked" handler="linphone_gtk_codec_disable"/>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox9">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -1540,9 +1586,9 @@ virtual network !</property>
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="tooltip-text" translatable="yes">0 stands for "unlimited"</property>
|
||||
<property name="tooltip_text" translatable="yes">0 stands for "unlimited"</property>
|
||||
<property name="adjustment">adjustment5</property>
|
||||
<signal handler="linphone_gtk_upload_bw_changed" name="value_changed"/>
|
||||
<signal name="value_changed" handler="linphone_gtk_upload_bw_changed"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
|
@ -1556,9 +1602,9 @@ virtual network !</property>
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="tooltip-text" translatable="yes">0 stands for "unlimited"</property>
|
||||
<property name="tooltip_text" translatable="yes">0 stands for "unlimited"</property>
|
||||
<property name="adjustment">adjustment6</property>
|
||||
<signal handler="linphone_gtk_download_bw_changed" name="value_changed"/>
|
||||
<signal name="value_changed" handler="linphone_gtk_download_bw_changed"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
|
@ -1603,6 +1649,9 @@ virtual network !</property>
|
|||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkHBox" id="hbox15">
|
||||
|
|
@ -1649,8 +1698,8 @@ virtual network !</property>
|
|||
<child>
|
||||
<object class="GtkComboBox" id="lang_combo">
|
||||
<property name="visible">True</property>
|
||||
<signal handler="linphone_gtk_lang_changed" name="changed"/>
|
||||
<property name="model">model7</property>
|
||||
<signal name="changed" handler="linphone_gtk_lang_changed"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="renderer7"/>
|
||||
<attributes>
|
||||
|
|
@ -1689,7 +1738,7 @@ virtual network !</property>
|
|||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal handler="linphone_gtk_ui_level_toggled" name="toggled"/>
|
||||
<signal name="toggled" handler="linphone_gtk_ui_level_toggled"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
@ -1708,6 +1757,9 @@ virtual network !</property>
|
|||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkHBox" id="hbox4">
|
||||
|
|
@ -1753,7 +1805,7 @@ virtual network !</property>
|
|||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<signal handler="linphone_gtk_parameters_closed" name="clicked"/>
|
||||
<signal name="clicked" handler="linphone_gtk_parameters_closed"/>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox3">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
|||
|
|
@ -102,9 +102,22 @@ void linphone_gtk_ipv6_toggled(GtkWidget *w){
|
|||
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)));
|
||||
}
|
||||
|
||||
void linphone_gtk_sip_port_changed(GtkWidget *w){
|
||||
linphone_core_set_sip_port(linphone_gtk_get_core(),
|
||||
(gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w)));
|
||||
void linphone_gtk_udp_sip_port_changed(GtkWidget *w){
|
||||
LCSipTransports tr;
|
||||
LinphoneCore *lc=linphone_gtk_get_core();
|
||||
|
||||
linphone_core_get_sip_transports(lc,&tr);
|
||||
tr.udp_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
|
||||
linphone_core_set_sip_transports(lc,&tr);
|
||||
}
|
||||
|
||||
void linphone_gtk_tcp_sip_port_changed(GtkWidget *w){
|
||||
LCSipTransports tr;
|
||||
LinphoneCore *lc=linphone_gtk_get_core();
|
||||
|
||||
linphone_core_get_sip_transports(lc,&tr);
|
||||
tr.tcp_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
|
||||
linphone_core_set_sip_transports(lc,&tr);
|
||||
}
|
||||
|
||||
void linphone_gtk_audio_port_changed(GtkWidget *w){
|
||||
|
|
@ -746,12 +759,16 @@ void linphone_gtk_show_parameters(void){
|
|||
GtkWidget *codec_list=linphone_gtk_get_widget(pb,"codec_list");
|
||||
int mtu;
|
||||
int ui_advanced;
|
||||
LCSipTransports tr;
|
||||
|
||||
/* NETWORK CONFIG */
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"ipv6_enabled")),
|
||||
linphone_core_ipv6_enabled(lc));
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"sip_port")),
|
||||
linphone_core_get_sip_port(lc));
|
||||
linphone_core_get_sip_transports(lc,&tr);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"udp_sip_port")),
|
||||
tr.udp_port);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"tcp_sip_port")),
|
||||
tr.tcp_port);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"audio_rtp_port")),
|
||||
linphone_core_get_audio_port(lc));
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"video_rtp_port")),
|
||||
|
|
|
|||
|
|
@ -192,6 +192,10 @@ void linphone_gtk_set_ui_config_int(const char *key , int val){
|
|||
lp_config_set_int(cfg,"GtkUi",key,val);
|
||||
}
|
||||
|
||||
void linphone_gtk_set_ui_config(const char *key , const char * val){
|
||||
LpConfig *cfg=linphone_core_get_config(linphone_gtk_get_core());
|
||||
lp_config_set_string(cfg,"GtkUi",key,val);
|
||||
}
|
||||
|
||||
static void parse_item(const char *item, const char *window_name, GtkWidget *w, gboolean show){
|
||||
char tmp[64];
|
||||
|
|
|
|||
|
|
@ -17,7 +17,16 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
/**
|
||||
* Object that represents a SIP address.
|
||||
* The LinphoneAddress is an opaque object to represents SIP addresses, ie the content of SIP's 'from' and 'to' headers.
|
||||
* A SIP address is made of display name, username, domain name, port, and various uri headers (such as tags).
|
||||
* It looks like 'Alice <sip:alice@example.net>'. The LinphoneAddress has methods to extract and manipulate all parts of the address.
|
||||
* When some part of the address (for example the username) is empty, the accessor methods return null.
|
||||
* <br> Can be instanciated using both {@link LinphoneCoreFactory#createLinphoneAddress(String, String, String)} or {@link LinphoneCoreFactory#createLinphoneAddress(String)}
|
||||
* @author jehanmonnier
|
||||
*
|
||||
*/
|
||||
public interface LinphoneAddress {
|
||||
/**
|
||||
* Human display name
|
||||
|
|
@ -58,6 +67,9 @@ public interface LinphoneAddress {
|
|||
*/
|
||||
public String asStringUriOnly();
|
||||
|
||||
/*must return the same thing as asString()*/
|
||||
/**
|
||||
* same as {@link #asString()}
|
||||
*
|
||||
* */
|
||||
public String toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,13 +17,51 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
/**
|
||||
* Object holding authentication information.
|
||||
* In most case, authentication information consists of a username and password. Sometimes, a userid is required by proxy, and realm can be useful to discriminate different SIP domains.
|
||||
*<br>This object is instanciated using {@link LinphoneCoreFactory#createAuthInfo(String, String, String)}.
|
||||
*<br>
|
||||
*Once created and filled, a LinphoneAuthInfo must be added to the LinphoneCore in order to become known and used automatically when needed.
|
||||
*Use {@link LinphoneCore#addAuthInfo(LinphoneAuthInfo)} for that purpose.
|
||||
*<br>
|
||||
*The LinphoneCore object can take the initiative to request authentication information when needed to the application
|
||||
*through the {@link LinphoneCoreListener#authInfoRequested(LinphoneCore, String, String)} listener.
|
||||
*<br>
|
||||
*The application can respond to this information request later using {@link LinphoneCore#addAuthInfo(LinphoneAuthInfo)}.
|
||||
*This will unblock all pending authentication transactions and retry them with authentication headers.
|
||||
*
|
||||
*/
|
||||
public interface LinphoneAuthInfo {
|
||||
/**
|
||||
* get user name
|
||||
* @return username
|
||||
*/
|
||||
String getUsername();
|
||||
String getPassword();
|
||||
String getRealm();
|
||||
/**
|
||||
* Sets the username.
|
||||
* @param username
|
||||
*/
|
||||
void setUsername(String username);
|
||||
/**
|
||||
* get password
|
||||
* @return password
|
||||
*/
|
||||
String getPassword();
|
||||
/**
|
||||
* sets password
|
||||
* @param password
|
||||
*/
|
||||
void setPassword(String password);
|
||||
/**
|
||||
* get realm
|
||||
* @return
|
||||
*/
|
||||
String getRealm();
|
||||
/**
|
||||
* set realm
|
||||
* @param realm
|
||||
*/
|
||||
void setRealm(String realm);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,26 +20,78 @@ package org.linphone.core;
|
|||
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
/**
|
||||
* Object representing a Call. calls are created using {@link LinphoneCore#invite(LinphoneAddress)} or paased to the application by listener {@link LinphoneCoreListener#callState(LinphoneCore, LinphoneCall, State, String)}
|
||||
*
|
||||
*/
|
||||
public interface LinphoneCall {
|
||||
/**
|
||||
* Linphone call states
|
||||
*
|
||||
*/
|
||||
static class State {
|
||||
static private Vector values = new Vector();
|
||||
private final int mValue;
|
||||
private final String mStringValue;
|
||||
/**
|
||||
* Idle
|
||||
*/
|
||||
public final static State Idle = new State(0,"Idle");
|
||||
/**
|
||||
* Incoming call received.
|
||||
*/
|
||||
public final static State IncomingReceived = new State(1,"IncomingReceived");
|
||||
/**
|
||||
* Outgoing call initialiazed.
|
||||
*/
|
||||
public final static State OutgoingInit = new State(2,"OutgoingInit");
|
||||
/**
|
||||
* Outgoing call in progress.
|
||||
*/
|
||||
public final static State OutgoingProgress = new State(3,"OutgoingProgress");
|
||||
/**
|
||||
* Outgoing call ringing.
|
||||
*/
|
||||
public final static State OutgoingRinging = new State(4,"OutgoingRinging");
|
||||
/**
|
||||
* Outgoing call early media
|
||||
*/
|
||||
public final static State OutgoingEarlyMedia = new State(5,"OutgoingEarlyMedia");
|
||||
/**
|
||||
* Connected
|
||||
*/
|
||||
public final static State Connected = new State(6,"Connected");
|
||||
/**
|
||||
* Streams running
|
||||
*/
|
||||
public final static State StreamsRunning = new State(7,"StreamsRunning");
|
||||
/**
|
||||
* Paussing
|
||||
*/
|
||||
public final static State Pausing = new State(8,"Pausing");
|
||||
/**
|
||||
* Paused
|
||||
*/
|
||||
public final static State Paused = new State(9,"Paused");
|
||||
/**
|
||||
* Resuming
|
||||
*/
|
||||
public final static State Resuming = new State(10,"Resuming");
|
||||
/**
|
||||
* Refered
|
||||
*/
|
||||
public final static State Refered = new State(11,"Refered");
|
||||
/**
|
||||
* Error
|
||||
*/
|
||||
public final static State Error = new State(12,"Error");
|
||||
/**
|
||||
* Call end
|
||||
*/
|
||||
public final static State CallEnd = new State(13,"CallEnd");
|
||||
/**
|
||||
* Paused by remote
|
||||
*/
|
||||
public final static State PausedByRemote = new State(14,"PausedByRemote");
|
||||
private State(int value,String stringValue) {
|
||||
mValue = value;
|
||||
|
|
@ -69,10 +121,14 @@ public interface LinphoneCall {
|
|||
*
|
||||
**/
|
||||
public LinphoneAddress getRemoteAddress();
|
||||
|
||||
/**
|
||||
* get direction of the call (incoming or outgoing).
|
||||
* @return CallDirection
|
||||
*/
|
||||
public CallDirection getDirection();
|
||||
/**
|
||||
* Returns the call log associated to this call.
|
||||
* get the call log associated to this call.
|
||||
* @Return LinphoneCallLog
|
||||
**/
|
||||
public LinphoneCallLog getCallLog();
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,10 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
/**
|
||||
* Call data records object
|
||||
*
|
||||
*/
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
|
|
@ -68,10 +71,20 @@ public interface LinphoneCallLog {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Originator of the call as a LinphoneAddress object.
|
||||
* @return LinphoneAddress
|
||||
*/
|
||||
public LinphoneAddress getFrom();
|
||||
|
||||
/**
|
||||
* Destination of the call as a LinphoneAddress object.
|
||||
* @return
|
||||
*/
|
||||
public LinphoneAddress getTo ();
|
||||
|
||||
/**
|
||||
* The direction of the call
|
||||
* @return CallDirection
|
||||
*/
|
||||
public CallDirection getDirection();
|
||||
/**
|
||||
* get status of this call
|
||||
|
|
|
|||
39
java/common/org/linphone/core/LinphoneChatRoom.java
Normal file
39
java/common/org/linphone/core/LinphoneChatRoom.java
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
LinphoneChatRoom.java
|
||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core;
|
||||
/**
|
||||
*
|
||||
* A chat room is the place where text messages are exchanged.
|
||||
Can be created by linphone_core_create_chat_room().
|
||||
*
|
||||
*/
|
||||
public interface LinphoneChatRoom {
|
||||
/**
|
||||
* get peer address associated to this LinphoneChatRoom
|
||||
*
|
||||
* @return LinphoneAddress peer address
|
||||
*/
|
||||
LinphoneAddress getPeerAddress();
|
||||
/**
|
||||
* send a message to peer member of this chat room.
|
||||
* @param message to be sent
|
||||
*/
|
||||
void sendMessage(String message);
|
||||
|
||||
}
|
||||
|
|
@ -21,17 +21,31 @@ package org.linphone.core;
|
|||
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
/**
|
||||
* Linphone core main object created by method {@link LinphoneCoreFactory#createLinphoneCore(LinphoneCoreListener, String, String, Object)}.
|
||||
*
|
||||
*/
|
||||
public interface LinphoneCore {
|
||||
/*
|
||||
/**
|
||||
* linphone core states
|
||||
*/
|
||||
static public class GlobalState {
|
||||
static private Vector values = new Vector();
|
||||
|
||||
/**
|
||||
* Off
|
||||
*/
|
||||
static public GlobalState GlobalOff = new GlobalState(0,"GlobalOff");
|
||||
/**
|
||||
* Startup
|
||||
*/
|
||||
static public GlobalState GlobalStartup = new GlobalState(1,"GlobalStartup");
|
||||
/**
|
||||
* On
|
||||
*/
|
||||
static public GlobalState GlobalOn = new GlobalState(2,"GlobalOn");
|
||||
/**
|
||||
* Shutdown
|
||||
*/
|
||||
static public GlobalState GlobalShutdown = new GlobalState(3,"GlobalShutdown");
|
||||
|
||||
private final int mValue;
|
||||
|
|
@ -54,12 +68,31 @@ public interface LinphoneCore {
|
|||
return mStringValue;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Describes proxy registration states.
|
||||
*
|
||||
*/
|
||||
static public class RegistrationState {
|
||||
static private Vector values = new Vector();
|
||||
/**
|
||||
* None
|
||||
*/
|
||||
static public RegistrationState RegistrationNone = new RegistrationState(0,"RegistrationNone");
|
||||
/**
|
||||
* In Progress
|
||||
*/
|
||||
static public RegistrationState RegistrationProgress = new RegistrationState(1,"RegistrationProgress");
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
static public RegistrationState RegistrationOk = new RegistrationState(2,"RegistrationOk");
|
||||
/**
|
||||
* Cleared
|
||||
*/
|
||||
static public RegistrationState RegistrationCleared = new RegistrationState(3,"RegistrationCleared");
|
||||
/**
|
||||
* Failed
|
||||
*/
|
||||
static public RegistrationState RegistrationFailed = new RegistrationState(4,"RegistrationFailed");
|
||||
private final int mValue;
|
||||
private final String mStringValue;
|
||||
|
|
@ -81,8 +114,60 @@ public interface LinphoneCore {
|
|||
return mStringValue;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Describes proxy registration states.
|
||||
*
|
||||
*/
|
||||
static public class FirewallPolicy {
|
||||
static private Vector values = new Vector();
|
||||
/**
|
||||
* No firewall is assumed.
|
||||
*/
|
||||
static public FirewallPolicy NoFirewall = new FirewallPolicy(0,"NoFirewall");
|
||||
/**
|
||||
* Use NAT address (discouraged)
|
||||
*/
|
||||
static public FirewallPolicy UseNatAddress = new FirewallPolicy(1,"UseNatAddress");
|
||||
/**
|
||||
* Use stun server to discover RTP addresses and ports.
|
||||
*/
|
||||
static public FirewallPolicy UseStun = new FirewallPolicy(2,"UseStun");
|
||||
|
||||
private final int mValue;
|
||||
private final String mStringValue;
|
||||
|
||||
private FirewallPolicy(int value,String stringValue) {
|
||||
mValue = value;
|
||||
values.addElement(this);
|
||||
mStringValue=stringValue;
|
||||
}
|
||||
public static FirewallPolicy fromInt(int value) {
|
||||
|
||||
for (int i=0; i<values.size();i++) {
|
||||
FirewallPolicy state = (FirewallPolicy) values.elementAt(i);
|
||||
if (state.mValue == value) return state;
|
||||
}
|
||||
throw new RuntimeException("state not found ["+value+"]");
|
||||
}
|
||||
public String toString() {
|
||||
return mStringValue;
|
||||
}
|
||||
public int value(){
|
||||
return mValue;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Signaling transports
|
||||
*
|
||||
*/
|
||||
static public class Transport {
|
||||
/**
|
||||
* UDP transport
|
||||
*/
|
||||
public final static Transport udp =new Transport("udp");
|
||||
/**
|
||||
* TCP transport
|
||||
*/
|
||||
public final static Transport tcp =new Transport("tcp");
|
||||
private final String mStringValue;
|
||||
|
||||
|
|
@ -94,15 +179,26 @@ public interface LinphoneCore {
|
|||
}
|
||||
}
|
||||
/**
|
||||
* clear all added proxy config
|
||||
* clear all added proxy configs
|
||||
*/
|
||||
public void clearProxyConfigs();
|
||||
|
||||
/**
|
||||
* Add a proxy configuration. This will start registration on the proxy, if registration is enabled.
|
||||
* @param proxyCfg
|
||||
* @throws LinphoneCoreException
|
||||
*/
|
||||
public void addProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException;
|
||||
|
||||
/**
|
||||
* Sets the default proxy.
|
||||
*<br>
|
||||
* This default proxy must be part of the list of already entered {@link LinphoneProxyConfig}.
|
||||
* Toggling it as default will make LinphoneCore use the identity associated with the proxy configuration in all incoming and outgoing calls.
|
||||
* @param proxyCfg
|
||||
*/
|
||||
public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg);
|
||||
|
||||
/**
|
||||
* get he default proxy configuration, that is the one used to determine the current identity.
|
||||
* @return null if no default proxy config
|
||||
*/
|
||||
public LinphoneProxyConfig getDefaultProxyConfig() ;
|
||||
|
|
@ -111,7 +207,11 @@ public interface LinphoneCore {
|
|||
* clear all the added auth info
|
||||
*/
|
||||
void clearAuthInfos();
|
||||
|
||||
/**
|
||||
* Adds authentication information to the LinphoneCore.
|
||||
* <br>This information will be used during all SIP transacations that require authentication.
|
||||
* @param info
|
||||
*/
|
||||
void addAuthInfo(LinphoneAuthInfo info);
|
||||
|
||||
/**
|
||||
|
|
@ -123,13 +223,22 @@ public interface LinphoneCore {
|
|||
public LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException;
|
||||
|
||||
/**
|
||||
* Starts a call given a destination. Internally calls interpretUrl() then invite(LinphoneAddress).
|
||||
* Starts a call given a destination. Internally calls {@link #interpretUrl(String)} then {@link #invite(LinphoneAddress)}.
|
||||
* @param uri
|
||||
*/
|
||||
public LinphoneCall invite(String destination)throws LinphoneCoreException;
|
||||
|
||||
/**
|
||||
* Initiates an outgoing call given a destination LinphoneAddress
|
||||
*<br>The LinphoneAddress can be constructed directly using linphone_address_new(), or created by linphone_core_interpret_url(). The application doesn't own a reference to the returned LinphoneCall object. Use linphone_call_ref() to safely keep the LinphoneCall pointer valid within your application.
|
||||
* @param to the destination of the call (sip address).
|
||||
* @return LinphoneCall
|
||||
* @throws LinphoneCoreException
|
||||
*/
|
||||
public LinphoneCall invite(LinphoneAddress to)throws LinphoneCoreException;
|
||||
|
||||
/**
|
||||
* Terminates a call.
|
||||
* @param aCall to be terminated
|
||||
*/
|
||||
public void terminateCall(LinphoneCall aCall);
|
||||
/**
|
||||
* Returns The LinphoneCall the current call if one is in call
|
||||
|
|
@ -152,6 +261,17 @@ public interface LinphoneCore {
|
|||
* @return Returns true if in incoming call is pending, ie waiting for being answered or declined.
|
||||
*/
|
||||
public boolean isInComingInvitePending();
|
||||
/**
|
||||
* Main loop function. It is crucial that your application call it periodically.
|
||||
*
|
||||
* #iterate() performs various backgrounds tasks:
|
||||
* <li>receiving of SIP messages
|
||||
* <li> handles timers and timeout
|
||||
* <li> performs registration to proxies
|
||||
* <li> authentication retries The application MUST call this function from periodically, in its main loop.
|
||||
* <br> Be careful that this function must be call from the same thread as other liblinphone methods. In not the case make sure all liblinphone calls are serialized with a mutex.
|
||||
|
||||
*/
|
||||
public void iterate();
|
||||
/**
|
||||
* Accept an incoming call.
|
||||
|
|
@ -232,28 +352,106 @@ public interface LinphoneCore {
|
|||
public void stopDtmf();
|
||||
|
||||
/**
|
||||
*
|
||||
* remove all call logs
|
||||
*/
|
||||
public void clearCallLogs();
|
||||
|
||||
|
||||
/***
|
||||
* get payload type from mime type an clock rate
|
||||
*
|
||||
* return null if not found
|
||||
*/
|
||||
public PayloadType findPayloadType(String mime,int clockRate);
|
||||
|
||||
/**
|
||||
* not implemented yet
|
||||
* @param pt
|
||||
* @param enable
|
||||
* @throws LinphoneCoreException
|
||||
*/
|
||||
public void enablePayloadType(PayloadType pt, boolean enable) throws LinphoneCoreException;
|
||||
|
||||
/**
|
||||
* Enables or disable echo cancellation.
|
||||
* @param enable
|
||||
*/
|
||||
public void enableEchoCancellation(boolean enable);
|
||||
|
||||
/**
|
||||
* get EC status
|
||||
* @return true if echo cancellation is enabled.
|
||||
*/
|
||||
public boolean isEchoCancellationEnabled();
|
||||
|
||||
/**
|
||||
* not implemented yet
|
||||
* @param aTransport
|
||||
*/
|
||||
public void setSignalingTransport(Transport aTransport);
|
||||
|
||||
/**
|
||||
* not implemented
|
||||
* @param value
|
||||
*/
|
||||
public void enableSpeaker(boolean value);
|
||||
|
||||
/**
|
||||
* not implemented
|
||||
* @return
|
||||
*/
|
||||
public boolean isSpeakerEnabled();
|
||||
/**
|
||||
* add a friend to the current buddy list, if subscription attribute is set, a SIP SUBSCRIBE message is sent.
|
||||
* @param lf LinphoenFriend to add
|
||||
* @throws LinphoneCoreException
|
||||
*/
|
||||
void addFriend(LinphoneFriend lf) throws LinphoneCoreException;
|
||||
|
||||
/**
|
||||
* Set my presence status
|
||||
* @param minute_away how long in away
|
||||
* @param status sip uri used to redirect call in state LinphoneStatusMoved
|
||||
*/
|
||||
void setPresenceInfo(int minute_away,String alternative_contact, OnlineStatus status);
|
||||
/**
|
||||
* Create a new chat room for messaging from a sip uri like sip:joe@sip.linphone.org
|
||||
* @param to destination address for messages
|
||||
*
|
||||
* @return {@link LinphoneChatRoom} where messaging can take place.
|
||||
*/
|
||||
LinphoneChatRoom createChatRoom(String to);
|
||||
|
||||
public void setVideoWindow(Object w);
|
||||
public void setPreviewWindow(Object w);
|
||||
/**
|
||||
* Enables video globally.
|
||||
*
|
||||
*
|
||||
* This function does not have any effect during calls. It just indicates #LinphoneCore to
|
||||
* initiate future calls with video or not. The two boolean parameters indicate in which
|
||||
* direction video is enabled. Setting both to false disables video entirely.
|
||||
*
|
||||
* @param vcap_enabled indicates whether video capture is enabled
|
||||
* @param display_enabled indicates whether video display should be shown
|
||||
*
|
||||
**/
|
||||
void enableVideo(boolean vcap_enabled, boolean display_enabled);
|
||||
/**
|
||||
* Returns TRUE if video is enabled, FALSE otherwise.
|
||||
*
|
||||
***/
|
||||
boolean isVideoEnabled();
|
||||
|
||||
/**
|
||||
* Specify a STUN server to help firewall traversal.
|
||||
* @param stun_server Stun server address and port, such as stun.linphone.org or stun.linphone.org:3478
|
||||
*/
|
||||
public void setStunServer(String stun_server);
|
||||
/**
|
||||
* @return stun server address if previously set.
|
||||
*/
|
||||
public String getStunServer();
|
||||
|
||||
/**
|
||||
* Sets policy regarding workarounding NATs
|
||||
* @param pol one of the FirewallPolicy members.
|
||||
**/
|
||||
public void setFirewallPolicy(FirewallPolicy pol);
|
||||
/**
|
||||
* @return previously set firewall policy.
|
||||
*/
|
||||
public FirewallPolicy getFirewallPolicy();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ package org.linphone.core;
|
|||
|
||||
|
||||
|
||||
|
||||
abstract public class LinphoneCoreFactory {
|
||||
|
||||
private static String factoryName = "org.linphone.core.LinphoneCoreFactoryImpl";
|
||||
|
|
@ -49,9 +50,21 @@ abstract public class LinphoneCoreFactory {
|
|||
abstract public LinphoneAuthInfo createAuthInfo(String username,String password, String realm);
|
||||
|
||||
abstract public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, String userConfig,String factoryConfig,Object userdata) throws LinphoneCoreException;
|
||||
|
||||
abstract public LinphoneCore createLinphoneCore(LinphoneCoreListener listener) throws LinphoneCoreException;
|
||||
|
||||
/**
|
||||
* Constructs a LinphoneAddress object
|
||||
* @param username
|
||||
* @param domain
|
||||
* @param displayName
|
||||
* @return
|
||||
*/
|
||||
abstract public LinphoneAddress createLinphoneAddress(String username,String domain,String displayName);
|
||||
|
||||
/**
|
||||
* Constructs a LinphoneAddress object by parsing the user supplied address, given as a string.
|
||||
* @param address should be like sip:joe@sip.linphone.org
|
||||
* @return
|
||||
*/
|
||||
abstract public LinphoneAddress createLinphoneAddress(String address);
|
||||
|
||||
abstract public LinphoneProxyConfig createProxyConfig(String identity, String proxy,String route,boolean enableRegister) throws LinphoneCoreException;
|
||||
|
|
@ -62,4 +75,17 @@ abstract public class LinphoneCoreFactory {
|
|||
abstract public void setDebugMode(boolean enable);
|
||||
|
||||
abstract public void setLogHandler(LinphoneLogHandler handler);
|
||||
/**
|
||||
* Create a LinphoneFriend, similar to {@link #createLinphoneFriend()} + {@link LinphoneFriend#setAddress(LinphoneAddress)}
|
||||
* @param friendUri a buddy address, must be a sip uri like sip:joe@sip.linphone.org
|
||||
* @return a new LinphoneFriend with address initialized
|
||||
*/
|
||||
abstract public LinphoneFriend createLinphoneFriend(String friendUri);
|
||||
/**
|
||||
* Create a new LinphoneFriend
|
||||
* @return
|
||||
*/
|
||||
abstract public LinphoneFriend createLinphoneFriend();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,15 +19,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
package org.linphone.core;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*This interface holds all callbacks that the application should implement. None is mandatory.
|
||||
*/
|
||||
public interface LinphoneCoreListener {
|
||||
|
||||
/**< Notifies the application that it should show up
|
||||
* @return */
|
||||
public void show(LinphoneCore lc);
|
||||
/**< Notify calls terminated by far end
|
||||
* @return */
|
||||
public void byeReceived(LinphoneCore lc,String from);
|
||||
/**< Ask the application some authentication information
|
||||
* @return */
|
||||
public void authInfoRequested(LinphoneCore lc,String realm,String username);
|
||||
|
|
@ -55,5 +55,28 @@ public interface LinphoneCoreListener {
|
|||
* Registration state notification
|
||||
* */
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState cstate, String smessage);
|
||||
/**
|
||||
* Reports that a new subscription request has been received and wait for a decision.
|
||||
*Status on this subscription request is notified by changing policy for this friend
|
||||
*@param lc LinphoneCore
|
||||
*@param lf LinphoneFriend corresponding to the subscriber
|
||||
*@param url of the subscriber
|
||||
*
|
||||
*/
|
||||
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url);
|
||||
/**
|
||||
* Report status change for a friend previously added to LinphoneCore.
|
||||
* @param lc LinphoneCore
|
||||
* @param lf updated LinphoneFriend
|
||||
*/
|
||||
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf);
|
||||
/**
|
||||
* invoked when a new text message is received
|
||||
* @param lc LinphoneCore
|
||||
* @param room LinphoneChatRoom involved in this conversation. Can be be created by the framework in case the from is not present in any chat room.
|
||||
* @param from LinphoneAddress from
|
||||
* @param message incoming message
|
||||
*/
|
||||
public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message);
|
||||
}
|
||||
|
||||
|
|
|
|||
122
java/common/org/linphone/core/LinphoneFriend.java
Normal file
122
java/common/org/linphone/core/LinphoneFriend.java
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
LinphoneFriend.java
|
||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Represents a buddy, all presence actions like subscription and status change notification are performed on this object
|
||||
*
|
||||
*
|
||||
*/
|
||||
public interface LinphoneFriend {
|
||||
/**
|
||||
* Enum controlling behavior for incoming subscription request.
|
||||
* Use by {@link LinphoneFriend#setIncSubscribePolicy()}
|
||||
*
|
||||
*/
|
||||
static class SubscribePolicy {
|
||||
static private Vector values = new Vector();
|
||||
protected final int mValue;
|
||||
private final String mStringValue;
|
||||
/**
|
||||
* Does not automatically accept an incoming subscription request.
|
||||
* This policy implies that a decision has to be taken for each incoming subscription request notified by {@link LinphoneCoreListener#newSubscriptionRequest(LinphoneCore, LinphoneFriend, String)}
|
||||
*/
|
||||
public final static SubscribePolicy SPWait = new SubscribePolicy(0,"SPWait");
|
||||
/**
|
||||
* Rejects incoming subscription request.
|
||||
*/
|
||||
public final static SubscribePolicy SPDeny = new SubscribePolicy(1,"SPDeny");
|
||||
/**
|
||||
* Automatically accepts a subscription request.
|
||||
*/
|
||||
public final static SubscribePolicy SPAccept = new SubscribePolicy(2,"SPAccept");
|
||||
private SubscribePolicy(int value,String stringValue) {
|
||||
mValue = value;
|
||||
values.addElement(this);
|
||||
mStringValue=stringValue;
|
||||
}
|
||||
public static SubscribePolicy fromInt(int value) {
|
||||
|
||||
for (int i=0; i<values.size();i++) {
|
||||
SubscribePolicy policy = (SubscribePolicy) values.elementAt(i);
|
||||
if (policy.mValue == value) return policy;
|
||||
}
|
||||
throw new RuntimeException("Policy not found ["+value+"]");
|
||||
}
|
||||
public String toString() {
|
||||
return mStringValue;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Set a {@link LinphoneAddress } for this friend
|
||||
* @param anAddress
|
||||
*/
|
||||
void setAddress(LinphoneAddress anAddress);
|
||||
/**
|
||||
* get address of this friend
|
||||
* @return
|
||||
*/
|
||||
LinphoneAddress getAddress();
|
||||
/**
|
||||
* Configure incoming subscription policy for this friend.
|
||||
* @param policy to apply
|
||||
*/
|
||||
void setIncSubscribePolicy(SubscribePolicy policy);
|
||||
/**
|
||||
* get current subscription policy for this LinphoneFriend
|
||||
* @return
|
||||
*/
|
||||
SubscribePolicy getIncSubscribePolicy();
|
||||
/**
|
||||
* Configure LinphoneFriend to subscribe to presence information
|
||||
* @param enable if true this friend will receive subscription message
|
||||
*/
|
||||
void enableSubscribes(boolean enable);
|
||||
/**
|
||||
* get subscription flag value
|
||||
* @return true is subscription is activated for this friend.
|
||||
*/
|
||||
boolean isSubscribesEnabled();
|
||||
/**
|
||||
* get friend status
|
||||
* @return
|
||||
*/
|
||||
OnlineStatus getStatus();
|
||||
/**
|
||||
* Starts editing a friend configuration.
|
||||
*<br> Because friend configuration must be consistent, applications MUST call {@link #edit()} before doing any attempts to modify friend configuration (such as address or subscription policy and so on).
|
||||
*Once the modifications are done, then the application must call {@link #done()} to commit the changes.
|
||||
*/
|
||||
void edit();
|
||||
/**
|
||||
* Commits modification made to the friend configuration.
|
||||
*/
|
||||
void done();
|
||||
/**
|
||||
* Human readable representation of this friend
|
||||
* @return
|
||||
*/
|
||||
String toString();
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -17,7 +17,11 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
/**
|
||||
* Interface to implement for handling liblinphone log.
|
||||
* <br> use {@link LinphoneCoreFactory#setLogHandler(LinphoneLogHandler)}
|
||||
*
|
||||
*/
|
||||
public interface LinphoneLogHandler {
|
||||
public static final int Fatal=1<<4;
|
||||
public static final int Error=1<<3|Fatal;
|
||||
|
|
@ -25,5 +29,13 @@ public interface LinphoneLogHandler {
|
|||
public static final int Info=1<<1|Warn;
|
||||
public static final int Debug=1|Info;
|
||||
|
||||
/**
|
||||
* Method invoked for each traces
|
||||
* @param loggerName
|
||||
* @param level
|
||||
* @param levelString
|
||||
* @param msg
|
||||
* @param e
|
||||
*/
|
||||
public void log(String loggerName, int level, String levelString, String msg, Throwable e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,34 +17,62 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
/**
|
||||
* The LinphoneProxyConfig object represents a proxy configuration to be used by the LinphoneCore object. Its fields must not be used directly in favour of the accessors methods.
|
||||
* Once created and filled properly the LinphoneProxyConfig can be given to LinphoneCore with {@link LinphoneCore#addProxyConfig(LinphoneProxyConfig)}. This will automatically triggers the registration, if enabled.
|
||||
*<br>The proxy configuration are persistent to restarts because they are saved in the configuration file. As a consequence, after {@link LinphoneCoreFactory#createLinphoneCore(LinphoneCoreListener, String, String, Object)} there might already be a default proxy that can be examined with {@link LinphoneCore#getDefaultProxyConfig()} .
|
||||
*
|
||||
*/
|
||||
public interface LinphoneProxyConfig {
|
||||
|
||||
/**
|
||||
* Unregister proxy config a enable edition
|
||||
*Starts editing a proxy configuration.
|
||||
*Because proxy configuration must be consistent, applications MUST call {@link #edit()} before doing any attempts to modify proxy configuration (such as identity, proxy address and so on).
|
||||
*Once the modifications are done, then the application must call {@link #done()} to commit the changes.
|
||||
*/
|
||||
public void edit();
|
||||
/**
|
||||
* Validate proxy config changes. Start registration in case
|
||||
* Commits modification made to the proxy configuration.
|
||||
*/
|
||||
public void done();
|
||||
/**
|
||||
* sip user made by sip:username@domain
|
||||
* Sets the user identity as a SIP address.
|
||||
* @param identy This identity is normally formed with display name, username and domain, such as: Alice <sip:alice@example.net> The REGISTER messages will have from and to set to this identity.
|
||||
*/
|
||||
public void setIdentity(String identity) throws LinphoneCoreException;
|
||||
/**
|
||||
* Set proxy uri, like sip:linphone.org:5060
|
||||
*get the SIP identity that belongs to this proxy configuration.
|
||||
*
|
||||
* @return The SIP identity is a SIP address (Display Name <sip:username> )
|
||||
*/
|
||||
public String getIdentity();
|
||||
/**
|
||||
*Sets the proxy address
|
||||
* Examples of valid sip proxy address are:
|
||||
*<li>IP address: sip:87.98.157.38
|
||||
*<li>IP address with port: sip:87.98.157.38:5062
|
||||
*<li>hostnames : sip:sip.example.net
|
||||
* @param proxyUri
|
||||
* @throws LinphoneCoreException
|
||||
*/
|
||||
public void setProxy(String proxyUri) throws LinphoneCoreException;
|
||||
/**
|
||||
* get the proxy's SIP address.
|
||||
*
|
||||
*/
|
||||
public String getProxy();
|
||||
/**
|
||||
* Enable register for this proxy config.
|
||||
* Register message is issued after call to {@link #done()}
|
||||
* @param value
|
||||
* @throws LinphoneCoreException
|
||||
*/
|
||||
*/
|
||||
public void enableRegister(boolean value) throws LinphoneCoreException;
|
||||
/**
|
||||
* @return true if registration to the proxy is enabled.
|
||||
*/
|
||||
public boolean registerEnabled();
|
||||
|
||||
/**
|
||||
* normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222
|
||||
* @param number
|
||||
|
|
@ -52,7 +80,7 @@ public interface LinphoneProxyConfig {
|
|||
*/
|
||||
public String normalizePhoneNumber(String number);
|
||||
/**
|
||||
* usefull function to automatically add internationnal prefix to e164 phone numbers
|
||||
* Useful function to automatically add international prefix to e164 phone numbers
|
||||
* @param prefix
|
||||
*/
|
||||
public void setDialPrefix(String prefix);
|
||||
|
|
@ -64,15 +92,25 @@ public interface LinphoneProxyConfig {
|
|||
public void setDialEscapePlus(boolean value);
|
||||
|
||||
/**
|
||||
* rget domain host name or ip
|
||||
* get domain host name or ip
|
||||
* @return may be null
|
||||
*/
|
||||
public String getDomain();
|
||||
public String getIdentity();
|
||||
public String getProxy();
|
||||
public boolean registerEnabled();
|
||||
/**
|
||||
*
|
||||
* @return a boolean indicating that the user is successfully registered on the proxy.
|
||||
*/
|
||||
public boolean isRegistered();
|
||||
/**
|
||||
* Sets a SIP route. When a route is set, all outgoing calls will go to the route's destination if this proxy is the default one (see {@link LinphoneCore#getDefaultProxyConfig()} ).
|
||||
* @param routeUri ex sip:git.linphone.org
|
||||
* @throws LinphoneCoreException
|
||||
*/
|
||||
public void setRoute(String routeUri) throws LinphoneCoreException;
|
||||
/**
|
||||
*
|
||||
* @return the route set for this proxy configuration.
|
||||
*/
|
||||
public String getRoute();
|
||||
|
||||
}
|
||||
|
|
|
|||
96
java/common/org/linphone/core/OnlineStatus.java
Normal file
96
java/common/org/linphone/core/OnlineStatus.java
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
OnlineStatus.java
|
||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
/**
|
||||
* Enum describing remote friend status
|
||||
*
|
||||
*/
|
||||
public class OnlineStatus {
|
||||
|
||||
static private Vector values = new Vector();
|
||||
/**
|
||||
* Offline
|
||||
*/
|
||||
static public OnlineStatus Offline = new OnlineStatus(0,"Offline");
|
||||
/**
|
||||
* Online
|
||||
*/
|
||||
static public OnlineStatus Online = new OnlineStatus(1,"Online");
|
||||
/**
|
||||
* Busy
|
||||
*/
|
||||
static public OnlineStatus Busy = new OnlineStatus(2,"Busy");
|
||||
/**
|
||||
* Be Right Back
|
||||
*/
|
||||
static public OnlineStatus BeRightBack = new OnlineStatus(3,"BeRightBack");
|
||||
/**
|
||||
* Away
|
||||
*/
|
||||
static public OnlineStatus Away = new OnlineStatus(4,"Away");
|
||||
/**
|
||||
* On The Phone
|
||||
*/
|
||||
static public OnlineStatus OnThePhone = new OnlineStatus(5,"OnThePhone");
|
||||
/**
|
||||
* Out To Lunch
|
||||
*/
|
||||
static public OnlineStatus OutToLunch = new OnlineStatus(6,"OutToLunch ");
|
||||
/**
|
||||
* Do Not Disturb
|
||||
*/
|
||||
static public OnlineStatus DoNotDisturb = new OnlineStatus(7,"DoNotDisturb");
|
||||
/**
|
||||
* Moved in this sate, call can be redirected if an alternate contact address has been set using function {@link LinphoneCore#setPresenceInfo(int, String, OnlineStatus)}
|
||||
*/
|
||||
static public OnlineStatus StatusMoved = new OnlineStatus(8,"StatusMoved");
|
||||
/**
|
||||
* Using another messaging service
|
||||
*/
|
||||
static public OnlineStatus StatusAltService = new OnlineStatus(9,"StatusAltService");
|
||||
/**
|
||||
* Pending
|
||||
*/
|
||||
static public OnlineStatus Pending = new OnlineStatus(10,"Pending");
|
||||
|
||||
protected final int mValue;
|
||||
private final String mStringValue;
|
||||
|
||||
private OnlineStatus(int value,String stringValue) {
|
||||
mValue = value;
|
||||
values.addElement(this);
|
||||
mStringValue=stringValue;
|
||||
}
|
||||
public static OnlineStatus fromInt(int value) {
|
||||
|
||||
for (int i=0; i<values.size();i++) {
|
||||
OnlineStatus state = (OnlineStatus) values.elementAt(i);
|
||||
if (state.mValue == value) return state;
|
||||
}
|
||||
throw new RuntimeException("state not found ["+value+"]");
|
||||
}
|
||||
public String toString() {
|
||||
return mStringValue;
|
||||
}
|
||||
|
||||
}
|
||||
194
java/common/org/linphone/core/package.html
Normal file
194
java/common/org/linphone/core/package.html
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<html>
|
||||
<head>
|
||||
<!--
|
||||
|
||||
@(#)package.html
|
||||
|
||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
-->
|
||||
</head>
|
||||
<body bgcolor="white">
|
||||
|
||||
Liblinphone is a high level library for bringing SIP video call functionnality into an application. It aims at making easy the integration of the SIP video calls into any applications. All variants of linphone are directly based on it:
|
||||
|
||||
<li>linphone (GUI interface)
|
||||
<li>linphonec (console interface)
|
||||
<br> Liblinphone is GPL (see COPYING file). Please understand the licencing details before using it!
|
||||
|
||||
<br>For any use of this library beyond the rights granted to you by the GPL license, please contact Belledonne Communications (contact@belledonne-communications.com)
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>Package Specification</h2>
|
||||
|
||||
LibLinphone package is organized in submodules.
|
||||
<ul>
|
||||
<li><a href="#proxy">Managing proxies</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="#buddy">Managing Buddies and buddy list and presence</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="#chat">Chat room and Messaging</a>
|
||||
</ul>
|
||||
|
||||
<h2>Related Documentation</h2>
|
||||
|
||||
For overviews, tutorials, examples, guides, and tool documentation, please see:
|
||||
<ul>
|
||||
<li><a href="http://www.linphone.org">linphone web site</a>
|
||||
</ul>
|
||||
|
||||
<!-- Put @see and @since tags down here. -->
|
||||
<h3>
|
||||
<a name="proxy">Managing proxies</a>
|
||||
</h3>
|
||||
User registration is controled by {@link org.linphone.core.LinphoneProxyConfig } settings.
|
||||
<br> Each {@link org.linphone.core.LinphoneProxyConfig } object can be configured with registration informations
|
||||
like {@link org.linphone.core.LinphoneProxyConfig#setProxy proxy address } , {@link org.linphone.core.LinphoneProxyConfig#setIdentity user id}, and so on.
|
||||
<br> A created proxy config using {@link org.linphone.core.LinphoneCoreFactory#createProxyConfig }, once configured, must be added to {@link org.linphone.core.LinphoneCore} using function {@link org.linphone.core.LinphoneCore#addProxyConfig }.
|
||||
<br> It is recommended to set a default {@link org.linphone.core.LinphoneProxyConfig proxy config } using function {@link org.linphone.core.LinphoneCore#setDefaultProxyConfig }. Once done, if {@link org.linphone.core.LinphoneProxyConfig a proxy config } has been configured with attribute {@link org.linphone.core.LinphoneProxyConfig#enableRegister enable register } , next call to {@link org.linphone.core.LinphoneCore#iterate } triggers a SIP register.
|
||||
<br> Registration status is reported by {@link org.linphone.core.LinphoneCoreListener#registrationState registration listener}.
|
||||
<br>
|
||||
<br> This pseudo code demonstrates basic registration operations:
|
||||
<br>
|
||||
<pre>
|
||||
<code>
|
||||
|
||||
LinphoneProxyConfig proxy_cfg;
|
||||
/*create proxy config*/
|
||||
proxy_cfg = LinphoneCoreFactory.instance().createProxyConfig();
|
||||
/*parse identity*/
|
||||
LinphoneAddress from = LinphoneCoreFactory.instance().createAddress("sip:toto@sip.titi.com");
|
||||
LinphoneAuthInfo info;
|
||||
if (password!=NULL){
|
||||
info=LinphoneCoreFactory.instance().createAuthInfo(from.getUsername(),null,"secret",null,null); /*create authentication structure from identity*/
|
||||
lc.addAuthInfo(info); /*add authentication info to LinphoneCore*/
|
||||
}
|
||||
// configure proxy entries
|
||||
proxy_cfg.setIdenty(identity); /*set identity with user name and domain*/
|
||||
String server_addr = from.getDomain(); /*extract domain address from identity*/
|
||||
proxy_cfg.setProxy(server_addr); /* we assume domain = proxy server address*/
|
||||
proxy_cfg.enableRegister(true); /*activate registration for this proxy config*/
|
||||
|
||||
lc.addProxyConfig(proxy_cfg); /*add proxy config to linphone core*/
|
||||
lc.setDefaultProxyconfig(proxy_cfg); /*set to default proxy*/
|
||||
</code>
|
||||
</pre>
|
||||
<br>
|
||||
{@link org.linphone.core.LinphoneCoreListener#registrationState Registration state listener} :
|
||||
<pre>
|
||||
<code>
|
||||
void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState cstate, String message){
|
||||
System.out.println(New registration state ["+cstate+"] for user id ["+cfg.getUserName()+"] at proxy ["+cfg.getProxy()+"]";
|
||||
}
|
||||
</pre>
|
||||
</code>
|
||||
|
||||
<br><b>Authentication:</b>
|
||||
<br>Most of the time, registration requires {@link org.linphone.core.LinphoneAuthInfo authentication } to succed. {@link org.linphone.core.LinphoneAuthInfo} info must be either added to {@link org.linphone.core.LinphoneCore } using method {@link org.linphone.core.LinphoneCore#addAuthInfo } before {@link org.linphone.core.LinphoneProxyConfig} is added to Linphone core, or on demand from listener {@link org.linphone.core.LinphoneCoreListener#authInfoRequested(LinphoneCore, String, String)} .
|
||||
<br>
|
||||
<br><b>Unregistration:</b>
|
||||
<br> Unregistration or any changes to {@link org.linphone.core.LinphoneProxyConfig} must be first started by a call to function {@link org.linphone.core.LinphoneProxyConfig#edit } and validated by function {@link org.linphone.core.LinphoneProxyConfig#done }
|
||||
<br> This pseudo code shows how to unregister a user associated to a{@link org.linphone.core.LinphoneProxyConfig}
|
||||
<pre>
|
||||
<code>
|
||||
LinphoneProxyConfig proxy_cfg;
|
||||
lc.setDefaultProxyConfig(proxy_cfg); /* get default proxy config*/
|
||||
proxy_cfg.edit(); /*start editing proxy configuration*/
|
||||
proxy_cfg.enableRegister(false); /*de-activate registration for this proxy config*/
|
||||
proxy_cfg.done(); /*initiate REGISTER with expire = 0*/
|
||||
</pre>
|
||||
</code>
|
||||
<br>
|
||||
<br>
|
||||
<h3>
|
||||
<a name="buddy">Managing Buddies and buddy list and presence</a>
|
||||
</h3>
|
||||
<br>
|
||||
<b>Buddies and buddy list</b>
|
||||
<br>Each buddy is represented by a {@link org.linphone.core.LinphoneFriend } object created by function {@link org.linphone.core.LinphoneCoreFactory#createLinphoneFriend()}.
|
||||
Buddy configuration parameters like {@link org.linphone.core.LinphoneFriend#setAddress(LinphoneAddress) sip uri} or {@link org.linphone.core.LinphoneFriend#setIncSubscribePolicy(LinphoneFriend.SubscribePolicy) status publication} are configurable for each buddy.
|
||||
<br>Here under a typical buddy creation:
|
||||
<br>
|
||||
<pre>
|
||||
<code>
|
||||
LinphoneFriend my_friend=LinphoneFactory.instance().createFriend("sip:joe@sip.linphone.org"); /*creates friend object for buddy joe*/
|
||||
my_friend.enableSubscribes(true); /*configure this friend to emit SUBSCRIBE message after being added to LinphoneCore*/
|
||||
my_friend.setIncSubscribePolicy(LinphoneFriend.SubscribePolicy.Accept); /* accept Incoming subscription request for this friend*/
|
||||
</code>
|
||||
</pre>
|
||||
{@link LinphoneFriend friends } status changes are reported by {@link org.linphone.core.LinphoneCoreListener#notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf)} .
|
||||
<pre>
|
||||
<code>
|
||||
void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf){
|
||||
LinphoneAddress friend_address = lf.getAddress();
|
||||
System.out.println("New state ["+lf.getStatus()+"] for user id ["+friend_address+"] ");
|
||||
}
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
<br>Once created a buddy can be added to the buddy list using function {@link org.linphone.core.LinphoneCore#addFriend(LinphoneFriend lf) } . Added friends will be notified about {@link org.linphone.core.LinphoneCore#setPresenceInfo(int minute_away,String alternative_contact, OnlineStatus status) local status changes }
|
||||
<br>
|
||||
Any subsequente modifications to {@link org.linphone.core.LinphoneFriend} must be first started by a call to function to {@link org.linphone.core.LinphoneFriend#edit()} and validated by function {@link org.linphone.core.LinphoneFriend#done()}
|
||||
<pre>
|
||||
<code>
|
||||
my_friend.edit(); /* start editing friend */
|
||||
my_friend.enableSubscribes(true); /*disable subscription for this friend*/
|
||||
my_friend.done(); /*commit changes triggering an UNSUBSCRIBE message*/
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
<b> Publishing presence status </b>
|
||||
<br>Local presence status can be changed using function {@link org.linphone.core.LinphoneCore#setPresenceInfo }.New status is propagated to all friends {@link org.linphone.core.LinphoneCore#addFriend(LinphoneFriend lf) previously added } to LinphoneCore.
|
||||
<br>
|
||||
<br>
|
||||
<b>Handling incoming subscription request</b>
|
||||
<br> New incoming subscription requests are process according to{@link org.linphone.core.LinphoneFriend#setIncSubscribePolicy(LinphoneFriend.SubscribePolicy) the incoming subscription policy state} for subscription initiated by {@link org.linphone.core.LinphoneCore#addFriend(LinphoneFriend lf) members of the buddy list. }
|
||||
<br> For incoming request coming from an unknown buddy, the call back {@link org.linphone.core.LinphoneCoreListener#newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url)}
|
||||
|
||||
<h3>
|
||||
<a name="chat">Chat room and Messaging</a>
|
||||
</h3>
|
||||
<b> Exchanging text messages</b>
|
||||
<br> Messages are sent using {@link org.linphone.core.LinphoneChatRoom} object. First step is to create a {@link org.linphone.core.LinphoneCore#createChatRoom chat room }
|
||||
from a peer sip uri.
|
||||
<pre>
|
||||
<code>
|
||||
LinphoneChatRoom chat_room = lc.createChatRoom("sip:joe@sip.linphone.org");
|
||||
</pre>
|
||||
</code>
|
||||
<br>Once created, messages are sent using function {@link org.linphone.core.LinphoneChatRoom#sendMessage } .
|
||||
<pre>
|
||||
<code>
|
||||
chat_room.sendMessage("Hello world"); /*sending message*/
|
||||
</pre>
|
||||
</code>
|
||||
<br>Incoming message are received from {@link org.linphone.core.LinphoneCoreListener#textReceived a listener }
|
||||
<pre>
|
||||
<code>
|
||||
void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message) {
|
||||
System.out.println("Message ["+message+"] received from ["+from+"] ");
|
||||
}
|
||||
</code>
|
||||
<pre>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
./bin/avformat-52.dll
|
||||
./bin/avutil-50.dll
|
||||
./bin/libeXosip2-4.dll
|
||||
./bin/libogg-0.dll
|
||||
./bin/libtheora-0.dll
|
||||
./bin/libogg.dll
|
||||
./bin/libtheora.dll
|
||||
./bin/libxml2-2.dll
|
||||
./bin/libosip2-4.dll
|
||||
./bin/libosipparser2-4.dll
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ AC_REQUIRE([LP_CHECK_OSIP2])
|
|||
|
||||
case $target_os in
|
||||
*darwin*)
|
||||
OSIP_LIBS="$OSIP_LIBS -framework CoreFoundation -framework CFNetwork "
|
||||
OSIP_LIBS="$OSIP_LIBS -framework CoreFoundation "
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 955a7d6b8aa205e8a97d751dd8d3920de1595455
|
||||
Subproject commit ffacf56718c198cb80a290f7a65975916d8a9b6b
|
||||
2
oRTP
2
oRTP
|
|
@ -1 +1 @@
|
|||
Subproject commit 461dd13a0aad2a075a075bf618e68443475f7a24
|
||||
Subproject commit 7faf69b5eb260ae82ef1efbc49713ccedac7d737
|
||||
|
|
@ -12,6 +12,6 @@ status-orange.png \
|
|||
status-red.png \
|
||||
status-offline.png \
|
||||
contact-orange.png dialer-orange.png history-orange.png\
|
||||
startcall-green.png stopcall-red.png
|
||||
startcall-green.png stopcall-red.png addcall-green.png
|
||||
|
||||
EXTRA_DIST=$(pixmap_DATA)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ gtk/call_logs.ui
|
|||
gtk/main.ui
|
||||
gtk/sip_account.ui
|
||||
gtk/chatroom.ui
|
||||
gtk/incoming_call.ui
|
||||
gtk/parameters.ui
|
||||
gtk/buddylookup.ui
|
||||
gtk/waiting.ui
|
||||
|
|
@ -73,4 +72,4 @@ mediastreamer2/src/chanadapt.c
|
|||
mediastreamer2/src/itc.c
|
||||
mediastreamer2/src/extdisplay.c
|
||||
mediastreamer2/src/msiounit.c
|
||||
|
||||
mediastreamer2/src/x11video.c
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ $(INSTALL_ROOT): $(WORKDIR)
|
|||
|
||||
|
||||
#Inno Setup 5 compiler
|
||||
ISCC=ISCC.exe
|
||||
ISCC="c:\Program Files\Inno setup 5\ISCC.exe"
|
||||
|
||||
$(LINPHONE_SRC_DIR)/configure:
|
||||
cd $(LINPHONE_SRC_DIR) && ./autogen.sh
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ LINPHONE_SOUNDS=ringback.wav hello8000.wav hello16000.wav
|
|||
LINPHONE_RINGS=rings/orig.wav \
|
||||
rings/oldphone.wav \
|
||||
rings/oldphone-mono.wav \
|
||||
rings/oldphone-mono-30s.caf \
|
||||
rings/rock.wav \
|
||||
rings/bigben.wav \
|
||||
rings/toy.wav \
|
||||
|
|
|
|||
BIN
share/rings/oldphone-mono-30s.caf
Normal file
BIN
share/rings/oldphone-mono-30s.caf
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue