I have Freeswitch server sending CDR information (A leg only) in JSON to PHP script and I need to parse extension and phone number in every scenario possible:
Incoming call from PSTN to: user, group, callcenter app (answered, un-answered)
Outgoing call to PSTN from user (answered, un-answered)
Each scenario have to use different variable in the JSON - depends if was bridged or not, if it's incoming (destination_number), if it's outgoing (caller_id_number), etc.
I was using bridge_uuid to detect if the call was bridged, but still got calls where bridge_uuid is missing and last_app is bridge (with status ORIGINATOR_CANCEL).
I put together 7 scenarios, but still there are calls, where phone number appear in extension for some reason and vice-versa.
Is there any simple way to get this information from CDR?
SCENARIO 1:
outbound
bridge_uuid = exists
extension = callflow.0.caller_profile.caller_id_number
number = callflow.0.caller_profile.destination_number
SCENARIO 2:
outbound
bridge_uuid = not exists
extension = callflow.0.caller_profile.destination_number
number = callflow.0.caller_profile.caller_id_number
SCENARIO 3:
outbound
bridge_uuid = not exists
last_app = bridge
extension = callflow.0.caller_profile.caller_id_number
number = callflow.0.caller_profile.destination_number
SCENARIO 4:
inbound
bridge_uuid = exists
cc_agent_bridged = exists
extension = callflow.0.caller_profile.originatee.originatee_caller_profiles.0.destination_number
number = callflow.0.caller_profile.caller_id_number
SCENARIO 5:
inbound
bridge_uuid = exists
cc_agent_bridged = not exists
extension = callflow.0.caller_profile.caller_id_number
number = callflow.0.caller_profile.destination_number
SCENARIO 6:
inbound
bridge_uuid = not exists
extension = NULL
number = callflow.0.caller_profile.caller_id_number
SCENARIO 7:
inbound
bridge_uuid = exists
cc_agent_bridged = not exists
extension = ???
number = ???
JSON CDR
'core-uuid' => 'bf6eef3c-16b7-4f61-8cc2-1cd73460268e',
'switchname' => 'freeswitch',
'channel_data' =>
array (
'state' => 'CS_REPORTING',
'direction' => 'outbound',
'state_number' => '11',
'flags' => '0=1;2=1;22=1;40=1;42=1;45=1;116=1;117=1',
'caps' => '1=1;2=1;3=1;4=1;5=1;6=1;8=1;9=1;10=1',
),
'callStats' =>
array (
),
'variables' =>
array (
'direction' => 'outbound',
'is_outbound' => 'true',
'uuid' => 'c9aa9f5f-7afd-46af-8cca-2af25b758aec',
'call_uuid' => 'c9aa9f5f-7afd-46af-8cca-2af25b758aec',
'session_id' => '4755',
'sip_profile_name' => 'homeoffice',
'video_media_flow' => 'disabled',
'text_media_flow' => 'disabled',
'channel_name' => 'sofia/homeoffice/4012%40XXX.XXX.XXX.XXX%3A56955',
'sip_destination_url' => 'sip%3A4012%40XXX.XXX.XXX.XXX%3A56955%3Btransport%3DUDP%3Brinstance%3D845ce1bf3f9efbf1%3Bfs_nat%3Dyes%3Bfs_path%3Dsip%3A4012%40XXX.XXX.XXX.XXX%3A56955%3Btransport%3DUDP%3Brinstance%3D845ce1bf3f9efbf1',
'origination_caller_id_name' => 'Name%20Surname',
'origination_caller_id_number' => '1829XXXXXXX',
'EXT_ID' => '163748',
'USER_ID' => '793',
'ID_TYPE' => 'application',
'callgroup' => 'local',
'dialed_user' => '4012',
'dialed_domain' => 'pbx.domain.com',
'sip_invite_domain' => 'pbx.domain.com',
'presence_id' => '4012%40pbx.domain.com',
'originate_early_media' => 'true',
'rtp_use_codec_string' => 'OPUS,G729,PCMU,PCMA,GSM',
'local_media_ip' => 'XXX.XXX.XXX.XXX',
'local_media_port' => '17432',
'advertised_media_ip' => 'XXX.XXX.XXX.XXX',
'audio_media_flow' => 'sendrecv',
'rtp_local_sdp_str' => 'v%3D0%0D%0Ao%3DFreeSWITCH%201646156158%201646156159%20IN%20IP4%20XXX.XXX.XXX.XXX%0D%0As%3DFreeSWITCH%0D%0Ac%3DIN%20IP4%20XXX.XXX.XXX.XXX%0D%0At%3D0%200%0D%0Am%3Daudio%2017432%20RTP/AVP%20102%2018%200%208%203%20103%20101%0D%0Aa%3Drtpmap%3A102%20opus/48000/2%0D%0Aa%3Dfmtp%3A102%20useinbandf
ec%3D1%3B%20maxaveragebitrate%3D30000%3B%20maxplaybackrate%3D48000%3B%20ptime%3D20%3B%20minptime%3D10%3B%20maxptime%3D40%0D%0Aa%3Drtpmap%3A18%20G729/8000%0D%0Aa%3Dfmtp%3A18%20annexb%3Dno%0D%0Aa%3Drtpmap%3A0%20PCMU/8000%0D%0Aa%3Drtpmap%3A8%20PCMA/8000%0D%0Aa%3Drtpmap%3A3%20GSM/8000%0D%0Aa%3Drtpmap%3A103%20telephone-e
vent/48000%0D%0Aa%3Dfmtp%3A103%200-15%0D%0Aa%3Drtpmap%3A101%20telephone-event/8000%0D%0Aa%3Dfmtp%3A101%200-15%0D%0Aa%3Dptime%3A20%0D%0Aa%3Dsendrecv%0D%0A',
'sip_outgoing_contact_uri' => '%3Csip%3Amod_sofia%40XXX.XXX.XXX.XXX%3A5090%3E',
'sip_req_uri' => '4012%40XXX.XXX.XXX.XXX%3A56955%3Btransport%3DUDP%3Brinstance%3D845ce1bf3f9efbf1',
'sip_nat_detected' => 'true',
'sofia_profile_name' => 'office',
'recovery_profile_name' => 'office',
'sofia_profile_url' => 'sip%3Amod_sofia%40XXX.XXX.XXX.XXX%3A5090',
'sip_local_network_addr' => 'XXX.XXX.XXX.XXX',
'sip_reply_host' => 'XXX.XXX.XXX.XXX',
'sip_reply_port' => '56955',
'sip_network_ip' => 'XXX.XXX.XXX.XXX',
'sip_network_port' => '56955',
'sip_user_agent' => 'Z%205.5.9%20v2.10.17.3',
'sip_allow' => 'INVITE,%20ACK,%20CANCEL,%20BYE,%20NOTIFY,%20REFER,%20MESSAGE,%20OPTIONS,%20INFO,%20SUBSCRIBE',
'sip_recover_contact' => '%3Csip%3A4012%40XXX.XXX.XXX.XXX%3A56955%3Btransport%3DUDP%3E',
'sip_full_via' => 'SIP/2.0/UDP%20XXX.XXX.XXX.XXX%3A5090%3Brport%3D5090%3Bbranch%3Dz9hG4bKS6tvm613tKgpg',
'sip_recover_via' => 'SIP/2.0/UDP%20XXX.XXX.XXX.XXX%3A5090%3Brport%3D5090%3Bbranch%3Dz9hG4bKS6tvm613tKgpg',
'sip_from_display' => 'Name%20Surname',
'sip_full_from' => '%22Name%20Surname%22%20%3Csip%3A1829XXXXXXX%40pbx.domain.com%3E%3Btag%3DDc8U2HQFrDQ4D',
'sip_full_to' => '%3Csip%3A4012%40XXX.XXX.XXX.XXX%3A56955%3Btransport%3DUDP%3Brinstance%3D845ce1bf3f9efbf1%3E%3Btag%3De4ab0722',
'sip_from_user' => '1829XXXXXXX',
'sip_from_uri' => '1829XXXXXXX%40pbx.domain.com',
'sip_from_host' => 'pbx.domain.com',
'sip_to_params' => 'transport%3DUDP%3Brinstance%3D845ce1bf3f9efbf1',
'sip_to_user' => '4012',
'sip_to_port' => '56955',
'sip_to_uri' => '4012%40XXX.XXX.XXX.XXX%3A56955',
'sip_to_host' => 'XXX.XXX.XXX.XXX',
'sip_contact_params' => 'transport%3DUDP',
'sip_contact_user' => '4012',
'sip_contact_port' => '56955',
'sip_contact_uri' => '4012%40XXX.XXX.XXX.XXX%3A56955',
'sip_contact_host' => 'XXX.XXX.XXX.XXX',
'sip_to_tag' => 'e4ab0722',
'sip_from_tag' => 'Dc8U2HQFrDQ4D',
'sip_cseq' => '48533003',
'sip_call_id' => '7ba03d12-1451-123b-ff84-ac1f6b94e36c',
'hangup_cause' => 'NO_ANSWER',
'hangup_cause_q850' => '19',
'digits_dialed' => 'none',
'start_stamp' => '2022-03-01%2018%3A26%3A30',
'profile_start_stamp' => '2022-03-01%2018%3A26%3A30',
'progress_stamp' => '2022-03-01%2018%3A26%3A30',
'end_stamp' => '2022-03-01%2018%3A27%3A30',
'start_epoch' => '1646173590',
'start_uepoch' => '1646173590060292',
'profile_start_epoch' => '1646173590',
'profile_start_uepoch' => '1646173590060292',
'answer_epoch' => '0',
'answer_uepoch' => '0',
'bridge_epoch' => '0',
'bridge_uepoch' => '0',
'last_hold_epoch' => '0',
'last_hold_uepoch' => '0',
'hold_accum_seconds' => '0',
'hold_accum_usec' => '0',
'hold_accum_ms' => '0',
'resurrect_epoch' => '0',
'resurrect_uepoch' => '0',
'progress_epoch' => '1646173590',
'progress_uepoch' => '1646173590620111',
'progress_media_epoch' => '0',
'progress_media_uepoch' => '0',
'end_epoch' => '1646173650',
'end_uepoch' => '1646173650000174',
'caller_id' => '%22Name%20Surname%22%20%3C1829XXXXXXX%3E',
'duration' => '60',
'billsec' => '0',
'progresssec' => '0',
'answersec' => '0',
'waitsec' => '0',
'progress_mediasec' => '0',
'flow_billsec' => '0',
'mduration' => '59940',
'billmsec' => '0',
'progressmsec' => '560',
'answermsec' => '0',
'waitmsec' => '0',
'progress_mediamsec' => '0',
'flow_billmsec' => '0',
'uduration' => '59939882',
'billusec' => '0',
'progressusec' => '559819',
'answerusec' => '0',
'waitusec' => '0',
'progress_mediausec' => '0',
'flow_billusec' => '0',
'sip_hangup_disposition' => 'send_cancel',
'sip_invite_failure_status' => '487',
'sip_invite_failure_phrase' => 'CANCEL',
),
'callflow' =>
array (
0 =>
array (
'profile_index' => '1',
'caller_profile' =>
array (
'username' => '',
'dialplan' => '',
'caller_id_name' => 'Name Surname',
'ani' => '1829XXXXXXX',
'aniii' => '',
'caller_id_number' => '1829XXXXXXX',
'network_addr' => 'XXX.XXX.XXX.XXX',
'rdnis' => '',
'destination_number' => '4012',
'uuid' => 'c9aa9f5f-7afd-46af-8cca-2af25b758aec',
'source' => 'src/switch_ivr_originate.c',
'context' => 'default',
'chan_name' => 'sofia/office/4012#XXX.XXX.XXX.XXX:56955',
),
'times' =>
array (
'created_time' => '1646173590060292',
'profile_created_time' => '1646173590060292',
'progress_time' => '1646173590620111',
'progress_media_time' => '0',
'answered_time' => '0',
'bridged_time' => '0',
'last_hold_time' => '0',
'hold_accum_time' => '0',
'hangup_time' => '1646173650000174',
'resurrect_time' => '0',
'transfer_time' => '0',
),
),
),
)
PHP SCRIPT
$data = json_decode($data_above, true);
$bridged = isset($data['variables']['bridge_uuid']);
$callcenter = isset($data['variables']['cc_agent_bridged']);
$direction = $data['variables']['direction'];
$extension = $data['callflow'][0]['caller_profile'];
$extension = match($direction)
{
'inbound'=>match($bridged)
{
true => match($callcenter)
{
true => $extension['originatee']['originatee_caller_profiles'][0]['destination_number'],
false => 'caller_id_number'
},
false => ''
},
'outbound'=>match($bridged)
{
true => 'caller_id_number',
false => $data['variables']['last_app'] == 'bridge' ? 'caller_id_number' : 'destination_number'
}
};
Related
I have this data:
[2022-12-07 11:56:19] local.INFO: array (
'name' => NULL,
'import_period' => NULL,
'google_ads_account' => NULL,
'period' => NULL,
'period_date_from' => NULL,
'period_date_to' => NULL,
'id_campaigns' =>
array (
0 =>
array (
'id_campaign' => NULL,
),
),
'id_adgroups' =>
array (
0 =>
array (
'id_adgroup' => NULL,
),
),
'campaign_name_contains' => NULL,
'adgroup_name_contains' => NULL,
'click' => 'less_than',
'click_value' => NULL,
'click_from' => NULL,
'click_to' => NULL,
'impressions' => 'less_than',
'impressions_value' => NULL,
'impressions_from' => NULL,
'impressions_to' => NULL,
'cost' => 'less_than',
'cost_value' => NULL,
'cost_from' => NULL,
'cost_to' => NULL,
'conversions' => 'less_than',
'conversions_value' => NULL,
'conversions_from' => NULL,
'conversions_to' => NULL,
'mapping_list' =>
array (
0 =>
array (
'value' => 'conversions',
'text' => NULL,
),
1 =>
array (
'value' => 'roas',
'text' => NULL,
),
2 =>
array (
'value' => 'all_conversions',
'text' => NULL,
),
3 =>
array (
'value' => 'all_conversions_from_interactions_rate',
'text' => NULL,
),
4 =>
array (
'value' => 'ctr',
'text' => NULL,
),
5 =>
array (
'value' => 'average_cpc',
'text' => NULL,
),
6 =>
array (
'value' => 'clicks',
'text' => NULL,
),
7 =>
array (
'value' => 'impressions',
'text' => NULL,
),
8 =>
array (
'value' => 'cost',
'text' => NULL,
),
9 =>
array (
'value' => 'conversions_value',
'text' => NULL,
),
10 =>
array (
'value' => 'conversions_from_interactions_rate',
'text' => NULL,
),
11 =>
array (
'value' => 'cost_per_conversion',
'text' => NULL,
),
12 =>
array (
'value' => 'search_click_share',
'text' => NULL,
),
13 =>
array (
'value' => 'search_impression_share',
'text' => NULL,
),
14 =>
array (
'value' => 'value_per_all_conversions',
'text' => NULL,
),
15 =>
array (
'value' => 'value_per_conversion',
'text' => NULL,
),
),
)
I am validating this data like this:
$validator = Validator::make($request->all(), [
'name' => 'required',
'import_period' => 'required',
'google_ads_account' => 'required',
'period' => 'required',
'period_date_from' => 'required_if:period,custom',
'period_date_to' => 'required_if:period,custom',
'id_campaigns.*.id_campaign'=> 'required',
'id_adgroups.*.id_adgroup' => 'required',
'campaign_name_contains' => 'required',
'adgroup_name_contains' => 'required',
'mapping_list.*.text' => 'required|min:1',
'click' => 'required',
'click_value' => 'required_if:click,greater_than,less_than',
'click_from' => 'required_if:click,between',
'click_to' => 'required_if:click,between',
'cost' => 'required',
'cost_value' => 'required_if:cost,greater_than,less_than',
'cost_from' => 'required_if:cost,between',
'cost_to' => 'required_if:cost,between',
'impressions' => 'required',
'impressions_value' => 'required_if:impressions,greater_than,less_than',
'impressions_from' => 'required_if:impressions,between',
'impressions_to' => 'required_if:impressions,between',
'conversions' => 'required',
'conversions_value' => 'required_if:conversions,greater_than,less_than',
'conversions_from' => 'required_if:conversions,between',
'conversions_to' => 'required_if:conversions,between',
]);
Here on this line 'mapping_list.*.text' => 'required|min:1' I am trying to validate this mapping_list array.
I want at least one field should be filled up but I have to fill up every element of this array.
Can you tell me is there anyting I am doing wrong?
If you want to validate that at least one field is filled, you must specify which field you want to validate. For example (in your code):
'mapping_list.*.text' => 'required|min:1',
you can change
'mapping_list.[0].text' => 'required|min:1',
or
'mapping_list.[1].text' => 'required|min:1',
That should be all you need to do. Hopefully that helps!
I have project for upload files on server, but I want to save them in php file ...
thats okay.. But when I want to delete them from the array with str_replace() It`s not happen...
from this array:
$files = array(
'2920525' => array(
'name' => 'Penguins',
'size' => '759.6 KB',
'unzip2920525' => NULL,
'pass2920525' => NULL,
'share2920525' => NULL,
'path' => 'uploads/anton_markov/99865723_Penguins.jpg',
),
'2683777' => array(
'name' => 'Lighthouse',
'size' => '548.1 KB',
'unzip2683777' => NULL,
'pass2683777' => NULL,
'share2683777' => NULL,
'path' => 'uploads/anton_markov/68670654_Lighthouse.jpg',
),
'6456807' => array(
'name' => 'Lighthouse - Копие - Копие',
'size' => '548.1 KB',
'unzip6456807' => NULL,
'pass6456807' => NULL,
'share6456807' => NULL,
'path' => 'uploads/anton_markov/94653321_Lighthouse---opie---opie.jpg',
),
'2363848' => array(
'name' => 'Koala',
'size' => '762.5 KB',
'unzip2363848' => NULL,
'pass2363848' => NULL,
'share2363848' => NULL,
'path' => 'uploads/anton_markov/15704345_Koala.jpg',
),
'6172497' => array(
'name' => 'Lighthouse',
'size' => '548.1 KB',
'unzip6172497' => NULL,
'pass6172497' => NULL,
'share6172497' => NULL,
'path' => 'uploads/anton_markov/53317261_Lighthouse.jpg',
),
);
I want to remove:
'6456807' => array(
'name' => 'Lighthouse - Копие - Копие',
'size' => '548.1 KB',
'unzip6456807' => NULL,
'pass6456807' => NULL,
'share6456807' => NULL,
'path' => 'uploads/anton_markov/94653321_Lighthouse---opie---opie.jpg',
),
I try with str_replace(),preg_replace() But nothing happen. I dont know why. When I remove the value from the array I want to save it. Please help me.
Just use unset.
unset($files['6456807']);
Since I'm really unexperienced with PHP, I'm having trouble retrieving specific data from the following array that I receive via API:
I need the values of
'id'
'amount'
'statsTags'
Unfortunatly the following code retrieves an undefined index error:
echo $commissions['TPerformant\API\Model\Commission::__set_state']['id'];
This is the content of the var_dump
var_dump($commissions):
array (
0 =>
TPerformant\API\Model\Commission::__set_state(array(
'id' => 457171,
'userId' => 8917,
'actionid' => 456657,
'actiontype' => 'sale',
'amount' => '0.31',
'status' => 'pending',
'affrequestId' => NULL,
'description' => 'cosmetics|Mascara Extra Super Lash Curved Brush 8 mlx1 (7% from 6.66), cosmetics|Sampon uscat Blush Dry 50 mlx1 (7% from 8.33), cosmetics|Crema de maini si corp cu Lavandax1 (7% from 4.99)',
'createdAt' => '2016-12-24T16:48:07Z',
'updatedAt' => '2016-12-24T16:48:07Z',
'reason' => NULL,
'statsTags' => ',undefinedDesktopnulla60949bd-0b06-4fd6-a324-0d65351c10e9,',
'history' => NULL,
'currency' => 'EUR',
'workingCurrencyCode' => 'RON',
'programId' => 882,
'amountInWorkingCurrency' => '1.4',
'program' =>
TPerformant\API\Model\AffiliateProgram::__set_state(array(
'affrequest' => NULL,
'id' => NULL,
'slug' => 'elefant-ro',
'name' => 'elefant.ro ',
'mainUrl' => NULL,
'baseUrl' => NULL,
'description' => NULL,
'activatedAt' => NULL,
'userId' => NULL,
'uniqueCode' => NULL,
'status' => NULL,
'cookieLife' => NULL,
'tos' => NULL,
'productFeedsCount' => NULL,
'productsCount' => NULL,
'bannersCount' => NULL,
'approvalTime' => NULL,
'currency' => NULL,
'enableLeads' => NULL,
'enableSales' => NULL,
'defaultLeadCommissionRate' => NULL,
'defaultLeadCommissionType' => NULL,
'defaultSaleCommissionRate' => NULL,
'defaultSaleCommissionType' => NULL,
'approvedCommissionCountRate' => NULL,
'approvedCommissionAmountRate' => NULL,
'paymentType' => 'postpaid',
'balanceIndicator' => NULL,
'downtime' => NULL,
'averagePaymentTime' => NULL,
'logoId' => NULL,
'logoPath' => NULL,
'userLogin' => 'elefant',
'category' => NULL,
'countries' => NULL,
'ignoreIPs' => NULL,
'requester' =>
TPerformant\API\HTTP\Affiliate::__set_state(array(
'accessToken' =>
array (
0 => 'notrelevant',
),
'clientToken' =>
array (
0 => 'notrelevant',
),
'uid' =>
array (
0 => 'notrelevant',
),
'userData' =>
TPerformant\API\Model\Affiliate::__set_state(array(
'id' => 8917,
'email' => 'notrelevant',
'login' => 'notrelevant',
'name' => 'notrelevant',
'role' => 'affiliate',
'uniqueCode' => 'notrelevant',
'createdAt' => '2012-04-17T10:25:11Z',
'avatarUrl' => 'https://secure.gravatar.com/avatar/2aa7cbeda20ce7dee64a2764004ef7b5?d=https://network.2performant.com%2Fimg%2Favatar-default.jpg',
'newsletterSubscription' => true,
'userInfo' =>
stdClass::__set_state(array(
'address' => 'Bucuresti',
'city' => 'Bucuresti',
'country' => 'Romania',
'display_name' => 'regular',
'firstname' => 'Andrei',
'lastname' => 'Ioniță',
'organization' => '',
'phone' => '',
'state' => 'Bucuresti',
'typeofbusiness' => '',
)),
'requester' => NULL,
)),
)),
)),
'publicActionData' =>
stdClass::__set_state(array(
'created_at' => '2016-12-24T16:48:07Z',
'updated_at' => '2016-12-24T16:48:07Z',
'rate' => '7.0',
'amount' => '4.41',
'ad_type' => 'quicklink',
'ad_id' => '882',
'source_ip' => '109.99.30.73',
'description' => 'cosmetics|Mascara Extra Super Lash Curved Brush 8 mlx1 (7% from 6.66), cosmetics|Sampon uscat Blush Dry 50 mlx1 (7% from 8.33), cosmetics|Crema de maini si corp cu Lavandax1 (7% from 4.99)',
'working_currency_code' => 'RON',
'amount_in_working_currency' => '19.98',
)),
'publicClickData' =>
stdClass::__set_state(array(
'created_at' => '2016-12-24T16:13:20Z',
'source_ip' => '109.99.30.73',
'url' => 'https://www.maller.ro/voucher-elefant-ro-40-reducere/',
'redirect_to' => 'http://www.elefant.ro/oferte-speciale#utm_source=2parale&utm_medium=Campaign&utm_campaign=2c42f3c4e',
'stats_tags' => ',undefinedDesktopnulla60949bd-0b06-4fd6-a324-0d65351c10e9,',
)),
'requester' =>
TPerformant\API\HTTP\Affiliate::__set_state(array(
'accessToken' =>
array (
0 => 'notrelevant',
),
'clientToken' =>
array (
0 => 'notrelevant',
),
'uid' =>
array (
0 => 'notrelevant',
),
'userData' =>
TPerformant\API\Model\Affiliate::__set_state(array(
'id' => 8917,
'email' => 'notrelevant',
'login' => 'notrelevant',
'name' => 'Andrei Ioniță',
'role' => 'affiliate',
'uniqueCode' => 'notrelevant',
'createdAt' => '2012-04-17T10:25:11Z',
'avatarUrl' => 'https://secure.gravatar.com/avatar/2aa7cbeda20ce7dee64a2764004ef7b5?d=https://network.2performant.com%2Fimg%2Favatar-default.jpg',
'newsletterSubscription' => true,
'userInfo' =>
stdClass::__set_state(array(
'address' => 'Bucuresti',
'city' => 'Bucuresti',
'country' => 'Romania',
'display_name' => 'regular',
'firstname' => 'Andrei',
'lastname' => 'Ioniță',
'organization' => '',
'phone' => '',
'state' => 'Bucuresti',
'typeofbusiness' => '',
)),
'requester' => NULL,
)),
)),
)),
When i try to send this request then i get error "id: 0 500 Internal Server Error - SoapFault".
My request:
$client = new SoapClient( 'xxx', array('trace' => 1));
$client -> soap_defencoding = 'utf-8';
$client -> decode_utf8 = FALSE;
$a = array( 'user_name' => 'xx', 'user_password' => 'xx' );
$response = $client->__soapCall( 'adeLogin', $a );
$session = get_object_vars($response)['session'];
$aCPrep = array(
'rname1' => 'Pan',
'rname2' => 'Jan',
'rname3' => 'test',
'rcountry' => 'PL',
'rzipcode' => '00-950',
'rcity' => 'Warszawa',
'rstreet' => 'ul. Kwieciska 15',
'quantity' => '1',
'rphone' => '1500-100-900',
'rcontact' => 'Antoni',
'weight' => '100',
'date' => '2012-01-01',
'references' => 'by WebAPI ',
'notes' => 'by Thomi (thest 4)',
'srv_ade' => 'asd',
'pfc' => 'Magazyn',
'sendaddr' => array( 'name1' => 'Firma z Francji', 'name2' => 'firma', 'name3' => 'firma2','country' => 'FR', 'zipcode' => '14117', 'city' => 'Arromanches', 'street' => 'Pl. du Six Juin 1944' ),
'srv_daw' => array( 'name' => '','building' => '','floor' => '','room' => '','phone' => '','altrec' => ''),
'srv_ident' => array( 'name' => '','country' => '','zipcode' => '','city' => '','street' => '','nation' => '','date_birth' => '','identity' => '','ident_doctype' => '','spages' => '','ssign' => '','sdealsend' => '','sdealrec' => ''),
'srv_ppe' => array( 'sname1' => '','sname2' => '','sname3' => '','scountry' => '','szipcode' => '','scity' => '','sstreet' => '','sphone' => '','scontact' => '','rname1' => '','rname2' => '','rname3' => '','rcountry' => '','rzipcode' => '','rcity' => '','rstreet' => '','rphone' => '','rcontact' => '','references' => '','weight' => ''),
'srv_bool' => array( 'cod' => '1', 'cod_amount' => '200', 'exw' => '0', 'rod' => '0', 'pod' => '0', 'exc' => '0','ident' => '0','daw' => '0','ps' => '0','pr' => '0','s10' => '0','s12' => '0','sat' => '0','ow' => '0','srs' => '0',),
'parcels' => array( '0' => array( 'weight' => '15', 'reference' => 'paczka duza','number' => '','srv_ade' => '', 'srv_bool' => array( 'cod' => '1', 'cod_amount' => '200', 'exw' => '0', 'rod' => '0', 'pod' => '0', 'exc' => '0','ident' => '0','daw' => '0','ps' => '0','pr' => '0','s10' => '0','s12' => '0','sat' => '0','ow' => '0','srs' => '0')))
);
$aCMsg = array( 'session' => $session, 'consign_prep_data' => $aCPrep );
$aClient = $client->__soapCall( 'adePreparingBox_Insert', $aCMsg );
It is error from my soap server or from symfony ? Anybody know what is wrong ?
How can i show the XML ?
it's response from SOAP server
Try
echo "REQUEST:\n".$client->__getLastRequest()."\n";
echo "RESPONSE:\n".$client->__getLastResponse()."\n";
*I solved it myself... like 10 minutes later. *
$varbgimg = $row->_field_data['nid']['entity']->field_slideimage['und'][0]['uri'];
Is what I used...
Hope someone can help me. How can I access 'uri' => 'public://veglo8.jpg'?
This is from Drupal and the Views module. If someone could maybe even help me with my ultimate goal, I would appreciate that...
I have a field in Views called slideimage. I want to add a style="background-image:url(image field URL);" to my div. Tried to rewrite the output but it strips the style...
Thanks in advance.
stdClass::__set_state(array(
'nid' => '20',
'node_title' => 'Test 1',
'field_data_field_slideimage_node_entity_type' => 'node',
'field_data_body_node_entity_type' => 'node',
'_field_data' =>
array (
'nid' =>
array (
'entity_type' => 'node',
'entity' =>
stdClass::__set_state(array(
'vid' => '20',
'uid' => '1',
'title' => 'Test 1',
'log' => '',
'status' => '1',
'comment' => '1',
'promote' => '0',
'sticky' => '0',
'nid' => '20',
'type' => 'test',
'language' => 'und',
'created' => '1358336066',
'changed' => '1358337923',
'tnid' => '0',
'translate' => '0',
'revision_timestamp' => '1358337923',
'revision_uid' => '1',
'body' =>
array (
'und' =>
array (
0 =>
array (
'value' => 'Body text here',
'summary' => '',
'format' => 'filtered_html',
'safe_value' => '
Body text here',
'safe_summary' => '',
),
),
),
'field_slideimage' =>
array (
'und' =>
array (
0 =>
array (
'fid' => '8',
'alt' => '',
'title' => '',
'width' => '624',
'height' => '390',
'uid' => '1',
'filename' => 'veglo8.jpg',
'uri' => 'public://veglo8.jpg',
'filemime' => 'image/jpeg',
'filesize' => '27393',
'status' => '1',
'timestamp' => '1358336725',
'rdf_mapping' =>
You can use file_create_url to convert public://... to real world URLs.
$real_url = file_create_url($img_src);
I've used the pathinfo() function for this in the past.
http://php.net/manual/en/function.pathinfo.php
You can apply styles programmatically with this by replacing user-picture[0]['uri'] with your image url. I think you can even place the whole public:// url in there and it will work just fine as well.
THUMBNAIL_STYLE = 'thumbnail';
// now get the full image url from the uri and the style
$default_thumbnail = image_style_url($THUMBNAIL_STYLE, $user->picture[0]['uri']);
http://drupal.org/node/1425836