1 <?xml version="1.0" encoding="UTF-8"?>
3 <sect1 id="zend.service.developergarden">
4 <title>Zend_Service_DeveloperGarden</title>
6 <sect2 id="zend.service.developergarden.introduction">
7 <title>Introduction to DeveloperGarden</title>
10 Developer Garden is the name of Deutsche Telekom’s developer community.
11 Developer Garden offers you access to core services of Deutsche Telekom,
12 such as voice connections (Voice Call) or sending text messages (Send SMS)
13 via open interfaces (Open APIs). You can access the Developer Garden
14 services directly via <acronym>SOAP</acronym> or <acronym>REST</acronym>.
18 The family of <classname>Zend_Service_DeveloperGarden</classname> components provides a
19 clean and simple interface to the <ulink
20 url="http://www.developergarden.com">Developer Garden APIs</ulink> and additionally
21 offers functionality to improve handling and performance.
28 linkend="zend.service.developergarden.baseuserservice">BaseUserService</link>:
29 Class to manage API quota and user accounting details.
35 <link linkend="zend.service.developergarden.iplocation">IPLocation</link>:
36 Locale the given IP and returns geo coordinates. Works only with IPs allocated
37 in the network of the Deutsche Telekom.
43 <link linkend="zend.service.developergarden.localsearch">LocalSearch</link>:
44 Allows you to search with options nearby or around a given geo coordinate or
51 <link linkend="zend.service.developergarden.sendsms">SendSMS</link>: Send a SMS
52 or Flash SMS to a given number.
58 <link linkend="zend.service.developergarden.smsvalidation">SMSValidation</link>:
59 You can validate a number to use it with SendSMS for also supply a back channel.
65 <link linkend="zend.service.developergarden.voicecall">VoiceCall</link>:
66 Initiates a call between two participants.
73 linkend="zend.service.developergarden.conferencecall">ConferenceCall</link>:
74 You can configure a whole conference room with participants for an adhoc
75 conference or you can also schedule your conference.
81 The backend <acronym>SOAP</acronym> API is documented
82 <ulink url="http://www.developergarden.com/openapi/dokumentation/">here</ulink>.
85 <sect3 id="zend.service.developergarden.account">
86 <title>Sign Up for an Account</title>
89 Before you can start using the DeveloperGarden API, you first have to
90 <ulink url="http://www.developergarden.com/register">sign up</ulink> for an account.
94 <sect3 id="zend.service.developergarden.environment">
95 <title>The Environment</title>
98 With the DeveloperGarden API you have the possibility to choose between 3 different
99 development environments.
105 <emphasis>production</emphasis>: In Production environment there are no
106 usage limitations. You have to pay for calls, sms and other services with
113 <emphasis>sandbox</emphasis>: In the Sandbox mode you can use the same
114 features (with limitations) as in the production without to paying
115 for them. This environment is suitable for testing your prototype.
121 <emphasis>mock</emphasis>: The Mock environment allows you to build your
122 application and have results but you do not initiate any action on the API
123 side. This environment is intended for testing during development.
129 For every environment and service, there are some special features (options)
130 available for testing. Please look <ulink
131 url="http://www.developergarden.com/openapi/dokumentation/">here</ulink> for
136 <sect3 id="zend.service.developergarden.config">
137 <title>Your configuration</title>
140 You can pass to all classes an array of configuration values. Possible values are:
146 <emphasis>username</emphasis>: Your DeveloperGarden API username.
152 <emphasis>password</emphasis>: Your DeveloperGarden API password.
158 <emphasis>environment</emphasis>: The environment that you selected.
163 <example id="zend.service.developergarden.config.example">
164 <title>Configuration Example</title>
166 <programlisting language="php"><![CDATA[
167 require_once 'Zend/Service/DeveloperGarden/SendSms.php';
169 'username' => 'yourUsername',
170 'password' => 'yourPassword',
171 'environment' => Zend_Service_DeveloperGarden_SendSms::ENV_PRODUCTION,
173 $service = new Zend_Service_DeveloperGarden_SendSms($config);
179 <sect2 id="zend.service.developergarden.baseuserservice">
180 <title>BaseUserService</title>
183 The class can be used to set and get quota values for the services and to fetch
188 The <methodname>getAccountBalance()</methodname> method fetches an array
189 of account id's with the current balance status (credits).
192 <example id="zend.service.developergarden.baseuserservice.getaccountbalance.example">
193 <title>Get account balance example</title>
195 <programlisting language="php"><![CDATA[
196 $service = new Zend_Service_DeveloperGarden_BaseUserService($config);
197 print_r($service->getAccountBalance());
201 <sect3 id="zend.service.developergarden.baseuserservice.getquotainformation">
202 <title>Get quota information</title>
205 You can fetch quota informations for a specific service module with the
209 <example id="zend.service.developergarden.baseuserservice.getquotainformation.example">
210 <title>Get quota information example</title>
212 <programlisting language="php"><![CDATA[
213 $service = new Zend_Service_DeveloperGarden_BaseUserService($config);
214 $result = $service->getSmsQuotaInformation(
215 Zend_Service_DeveloperGarden_BaseUserService::ENV_PRODUCTION
217 echo 'Sms Quota:<br />';
218 echo 'Max Quota: ', $result->getMaxQuota(), '<br />';
219 echo 'Max User Quota: ', $result->getMaxUserQuota(), '<br />';
220 echo 'Quota Level: ', $result->getQuotaLevel(), '<br />';
225 You get a <classname>result</classname> object that contains all the information
226 you need, optional you can pass to the <methodname>QuotaInformation</methodname>
227 method the environment constant to fetch the quota for the specific environment.
231 Here a list of all <methodname>getQuotaInformation</methodname> methods:
237 <methodname>getConfernceCallQuotaInformation()</methodname>
243 <methodname>getIPLocationQuotaInformation()</methodname>
249 <methodname>getLocalSearchQuotaInformation()</methodname>
255 <methodname>getSmsQuotaInformation()</methodname>
261 <methodname>getVoiceCallQuotaInformation()</methodname>
267 <sect3 id="zend.service.developergarden.baseuserservice.changequotainformation">
268 <title>Change quota information</title>
271 To change the current quota use one of the <methodname>changeQuotaPool</methodname>
272 methods. First parameter is the new pool value and the second one is the
277 id="zend.service.developergarden.baseuserservice.changequotainformation.example">
278 <title>Change quota information example</title>
280 <programlisting language="php"><![CDATA[
281 $service = new Zend_Service_DeveloperGarden_BaseUserService($config);
282 $result = $service->changeSmsQuotaPool(
284 Zend_Service_DeveloperGarden_BaseUserService::ENV_PRODUCTION
286 if (!$result->hasError()) {
287 echo 'updated Quota Pool';
293 Here a list of all <methodname>changeQuotaPool</methodname> methods:
299 <methodname>changeConferenceCallQuotaPool()</methodname>
305 <methodname>changeIPLocationQuotaPool()</methodname>
311 <methodname>changeLocalSearchQuotaPool()</methodname>
317 <methodname>changeSmsQuotaPool()</methodname>
323 <methodname>changeVoiceCallQuotaPool()</methodname>
330 <sect2 id="zend.service.developergarden.iplocation">
331 <title>IP Location</title>
334 This service allows you to retrieve location information for a given IP address.
338 There are some limitations:
343 <para>The IP address must be in the T-Home network</para>
347 <para>Just the next big city will be resolved</para>
351 <para>IPv6 is not supported yet</para>
355 <example id="zend.service.developergarden.iplocation.locateip.example">
356 <title>Locate a given IP</title>
358 <programlisting language="php"><![CDATA[
359 $service = new Zend_Service_DeveloperGarden_IpLocation($config);
360 $service->setEnvironment(
361 Zend_Service_DeveloperGarden_IpLocation::ENV_MOCK
363 $ip = new Zend_Service_DeveloperGarden_IpLocation_IpAddress('127.0.0.1');
364 print_r($service->locateIp($ip));
369 <sect2 id="zend.service.developergarden.localsearch">
370 <title>Local Search</title>
373 The Local Search service provides the location based search machine <ulink
374 url="http://www.suchen.de">suchen.de</ulink> via web service interface. For
375 more details, refer to <ulink
376 url="http://www.developergarden.com/static/docu/en/ch04s02s06.html">the
377 documentation</ulink>.
380 <example id="zend.service.developergarden.localsearch.example">
381 <title>Locate a Restaurant</title>
383 <programlisting language="php"><![CDATA[
384 $service = new Zend_Service_DeveloperGarden_LocalSearch($config);
385 $search = new Zend_Service_DeveloperGarden_LocalSearch_SearchParameters();
387 * @see http://www.developergarden.com/static/docu/en/ch04s02s06s04.html
389 $search->setWhat('pizza')
391 print_r($service->localSearch($search));
396 <sect2 id="zend.service.developergarden.sendsms">
397 <title>Send SMS</title>
400 The Send SMS service is used to send normal and Flash SMS to any number.
404 The following restrictions apply to the use of the SMS service:
410 An SMS or Flash SMS in the production environment must not be longer than
411 765 characters and must not be sent to more than 10 recipients.
417 An SMS or Flash SMS in the sandbox environment is shortened and enhanced by a
418 note from the DeveloperGarden. The maximum length of the message is 160
425 In the sandbox environment, a maximum of 10 SMS can be sent per day.
431 The following characters are counted twice:
432 <literal>| ^ € { } [ ] ~ \ LF</literal> (line break)
438 If a SMS or Flash SMS is longer than 160 characters, one message is charged for
439 each 153 characters (quota and credit).
445 Delivery cannot be guaranteed for SMS or Flash SMS to landline numbers.
451 The sender can be a maximum of 11 characters. Permitted characters are
458 The specification of a phone number as the sender is only permitted if the phone
459 number has been validated. (See: <link
460 linkend="zend.service.developergarden.smsvalidation">SMS Validation</link>)
465 <example id="zend.service.developergarden.sendsms.example">
466 <title>Sending an SMS</title>
468 <programlisting language="php"><![CDATA[
469 $service = new Zend_Service_DeveloperGarden_SendSms($config);
470 $sms = $service->createSms(
471 '+49-172-123456; +49-177-789012',
475 print_r($service->send($sms));]]></programlisting>
479 <sect2 id="zend.service.developergarden.smsvalidation">
480 <title>SMS Validation</title>
483 The SMS Validation service allows the validation of physical phone number to be used
484 as the sender of an SMS.
488 First, call <methodname>setValidationKeyword()</methodname> to receive an SMS
493 After you get your keyword, you have to use the <methodname>validate()</methodname> to
494 validate your number with the keyword against the service.
498 With the method <methodname>getValidatedNumbers()</methodname>, you will get a list
499 of all already validated numbers and the status of each.
502 <example id="zend.service.developergarden.smsvalidation.request.example">
503 <title>Request validation keyword</title>
505 <programlisting language="php"><![CDATA[
506 $service = new Zend_Service_DeveloperGarden_SmsValidation($config);
507 print_r($service->sendValidationKeyword('+49-172-123456'));
511 <example id="zend.service.developergarden.smsvalidation.validate.example">
512 <title>Validate a number with a keyword</title>
514 <programlisting language="php"><![CDATA[
515 $service = new Zend_Service_DeveloperGarden_SmsValidation($config);
516 print_r($service->validate('TheKeyWord', '+49-172-123456'));
521 To invalidate a validated number, call the method <methodname>inValidate()</methodname>.
525 <sect2 id="zend.service.developergarden.voicecall">
526 <title>Voice Call</title>
529 The Voice Call service can be used to set up a voice connection between two telephone
530 connections. For specific details please read the <ulink
531 url="http://www.developergarden.com/static/docu/en/ch04s02.html">API
532 Documentation</ulink>.
536 Normally the Service works as followed:
542 Call the first participant.
548 If the connection is successful, call the second participant.
554 If second participant connects succesfully, both participants are connected.
560 The call is open until one of the participants hangs up or the expire mechanism
566 <example id="zend.service.developergarden.voicecall.call.example">
567 <title>Call two numbers</title>
569 <programlisting language="php"><![CDATA[
570 $service = new Zend_Service_DeveloperGarden_VoiceCall($config);
571 $aNumber = '+49-30-000001';
572 $bNumber = '+49-30-000002';
573 $expiration = 30; // seconds
574 $maxDuration = 300; // 5 mins
575 $newCall = $service->newCall($aNumber, $bNumber, $expiration, $maxDuration);
576 echo $newCall->getSessionId();
581 If the call is initiated, you can ask the result object for the session ID and
582 use this session ID for an additional call to the <methodname>callStatus</methodname>
583 or <methodname>tearDownCall()</methodname> methods. The second parameter on the
584 <methodname>callStatus()</methodname> method call extends the expiration for this call.
587 <example id="zend.service.developergarden.voicecall.teardown.example">
588 <title>Call two numbers, ask for status, and cancel</title>
590 <programlisting language="php"><![CDATA[
591 $service = new Zend_Service_DeveloperGarden_VoiceCall($config);
592 $aNumber = '+49-30-000001';
593 $bNumber = '+49-30-000002';
594 $expiration = 30; // seconds
595 $maxDuration = 300; // 5 mins
597 $newCall = $service->newCall($aNumber, $bNumber, $expiration, $maxDuration);
599 $sessionId = $newCall->getSessionId();
601 $service->callStatus($sessionId, true); // extend the call
603 sleep(10); // sleep 10s and then tearDown
605 $service->tearDownCall($sessionId);
610 <sect2 id="zend.service.developergarden.conferencecall">
611 <title>ConferenceCall</title>
614 Conference Call allows you to setup and start a phone conference.
618 The following features are available:
624 Conferences with an immediate start
630 Conferences with a defined start date
636 Recurring conference series
642 Adding, removing, and muting of participants from a conference
648 Templates for conferences
654 Here is a list of currently implemented API methods:
660 <methodname>createConference()</methodname> creates a new conference
666 <methodname>updateConference()</methodname> updates an existing conference
672 <methodname>commitConference()</methodname> saves the conference, and, if no
673 date is configured, immediately starts the conference
679 <methodname>removeConference()</methodname> removes a conference
685 <methodname>getConferenceList()</methodname> returns a list of all configured
692 <methodname>getConferenceStatus()</methodname> displays information for an
699 <methodname>getParticipantStatus()</methodname> displays status information
700 about a conference participant
706 <methodname>newParticipant()</methodname> creates a new participant
712 <methodname>addParticipant()</methodname> adds a participant to a conference
718 <methodname>updateParticipant()</methodname> updates a participant,
719 usually to mute or redial the participant
725 <methodname>removeParticipant()</methodname> removes a participant from a
732 <methodname>getRunningConference()</methodname> requests the running instance of
739 <methodname>createConferenceTemplate()</methodname> creates a new conference
746 <methodname>getConferenceTemplate()</methodname> requests an existing conference
753 <methodname>updateConferenceTemplate()</methodname> updates existing conference
760 <methodname>removeConferenceTemplate()</methodname> removes a conference
767 <methodname>getConferenceTemplateList()</methodname> requests all conference
768 templates of an owner
774 <methodname>addConferenceTemplateParticipant()</methodname> adds a conference
775 participant to conference template
781 <methodname>getConferenceTemplateParticipant()</methodname> displays details of
782 a participant of a conference template
788 <methodname>updateConferenceTemplateParticipant()</methodname> updates
789 participant details within a conference template
795 <methodname>removeConferenceTemplateParticipant()</methodname> removes
796 a participant from a conference template
801 <example id="zend.service.developergarden.conferencecall.example">
802 <title>Ad-Hoc conference</title>
804 <programlisting language="php"><![CDATA[
805 $client = new Zend_Service_DeveloperGarden_ConferenceCall($config);
807 $conferenceDetails = new Zend_Service_DeveloperGarden_ConferenceCall_ConferenceDetail(
808 'Zend-Conference', // name for the conference
809 'this is my private zend conference', // description
810 60 // duration in seconds
813 $conference = $client->createConference('MyName', $conferenceDetails);
815 $part1 = new Zend_Service_DeveloperGarden_ConferenceCall_ParticipantDetail(
819 'your.name@example.com',
823 $client->newParticipant($conference->getConferenceId(), $part1);
824 // add a second, third ... participant
826 $client->commitConference($conference->getConferenceId());
831 <sect2 id="zend.service.developergarden.performance">
832 <title>Performance and Caching</title>
835 You can setup various caching options to improve the performance for resolving WSDL and
836 authentication tokens.
840 First of all, you can setup the internal SoapClient (PHP) caching values.
843 <example id="zend.service.developergarden.performance.wsdlcache.example">
844 <title>WSDL cache options</title>
846 <programlisting language="php"><![CDATA[
847 Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::setWsdlCache([PHP CONSTANT]);
852 The <constant>[PHP CONSTANT]</constant> can be one of the following values:
858 <constant>WSDL_CACHE_DISC</constant>: enabled disc caching
864 <constant>WSDL_CACHE_MEMORY</constant>: enabled memory caching
870 <constant>WSDL_CACHE_BOTH</constant>: enabled disc and memory caching
876 <constant>WSDL_CACHE_NONE</constant>: disabled both caching
882 If you also want to cache the result for calls to the SecuritTokenServer
883 you can setup a <classname>Zend_Cache</classname> instance and pass it to the
884 <methodname>setCache()</methodname>.
887 <example id="zend.service.developergarden.performance.cache.example">
888 <title>SecurityTokenServer cache option</title>
890 <programlisting language="php"><![CDATA[
891 $cache = Zend_Cache::factory('Core', ...);
892 Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::setCache($cache);